ZhiQiang_Yang98 05390d8abf 更新
2022-11-08 20:17:49 +08:00

49 lines
1.7 KiB
C

//
// Created by wakashaw on 22-6-27.
//
#include <stdio.h>
#include "rtklib.h"
#include <curl/curl.h>
#define AK "sCv68QFEMVLNgzGsmd2Ms6GyZoDbiiKp"
#define BAIDU_SERVICE_ID 233351
#define NAME "TC_NAV"
/* time to string --------------------------------------------------------------
* convert gtime_t struct to string
* args : gtime_t t I gtime_t struct
* char *s O string ("yyyy/mm/dd hh:mm:ss.ssss")
* int n I number of decimals
* return : none
*-----------------------------------------------------------------------------*/
//static void time2unix(gtime_t t, char *s, int n)
//{
// double ep[6];
//
// if (n<0) n=0; else if (n>12) n=12;
// if (1.0-t.sec<0.5/pow(10.0,n)) {t.time++; t.sec=0.0;};
// time2epoch(t,ep);
// sprintf(s,"%04.0f-%02.0f-%02.0f %02.0f:%02.0f:%0*.*f",ep[0],ep[1],ep[2],
// ep[3],ep[4],n<=0?2:n+3,n<=0?0:n,ep[5]);
//}
//
//void cm_baidu_track_addpoint(rtksvr_t *svr)
//{
// double llh[3];
// char sendline[4096];
// char unix_time[20];
// time2unix(svr->rtk.sol.time,unix_time,0);
// /* prepare data */
// ecef2pos(svr->rtk.sol.rr,llh);
// sprintf(sendline, "ak=%s&service_id=%d&entity_name=%s&latitude=%lf&longitude=%lf&loc_time=%s&coord_type_input=wgs84"
// ,AK,BAIDU_SERVICE_ID,NAME,llh[0]*R2D,llh[1]*R2D,unix_time);
//
// int ret = -1;
// char *url = "http://yingyan.baidu.com/api/v3/track/addpoint"; //request url
// char *content = "application/x-www-form-urlencoded";
// char request_body[1024] = {0};
// char *response;
// response = cm_http_post(url,NULL,content,request_body); //发送POST请求
// if(response != NULL)
// free(response);
//}