-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
78 lines (78 loc) · 2.38 KB
/
main.cpp
File metadata and controls
78 lines (78 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <iostream>
#include "include/Rtklib/rtklib_fun.h"
#include "include/IO_rtcm.h"
using namespace KPL_IO;
void *pthread_brd(void *)
{
const char *c_path = "119.96.165.202:8605";
stream_t m_unsyncConn;
strinit(&m_unsyncConn);
if (!stropen(&m_unsyncConn, STR_TCPCLI, STR_MODE_RW, c_path))
{
std::cout << "***ERROR(v_openRnx):can't reach the observation " << c_path << endl;
exit(1);
}
strsettimeout(&m_unsyncConn, 60000, 10000); /// 60s for timeout 10s for reconnect
unsigned char buff[1024] = {0};
while (1)
{
int nread = strread(&m_unsyncConn, buff, 1024);
for (int i = 0; i < nread; ++i)
{
IO_inputEphData(buff[i]);
}
if (nread == 0)
sleepms(10);
}
}
void *pthread_ssr(void *)
{
const char *c_path = "test:test@119.96.237.211:8005/SSR_COM";
stream_t m_unsyncConn;
strinit(&m_unsyncConn);
if (!stropen(&m_unsyncConn, STR_NTRIPCLI, STR_MODE_RW, c_path))
{
std::cout << "***ERROR(v_openRnx):can't reach the observation " << c_path << endl;
exit(1);
}
strsettimeout(&m_unsyncConn, 60000, 10000); /// 60s for timeout 10s for reconnect
unsigned char buff[1024] = {0};
while (1)
{
int nread = strread(&m_unsyncConn, buff, 1024);
for (int i = 0; i < nread; ++i)
{
IO_inputSsrData(buff[i]);
}
if (nread == 0)
sleepms(10);
}
}
int main(int argc, char *args[])
{
const char *c_path = "test:test@119.96.165.202:8600/TEST";
stream_t m_unsyncConn;
strinit(&m_unsyncConn);
if (!stropen(&m_unsyncConn, STR_NTRIPCLI, STR_MODE_RW, c_path))
{
std::cout << "***ERROR(v_openRnx):can't reach the observation " << c_path << endl;
exit(1);
}
strsettimeout(&m_unsyncConn, 60000, 10000); /// 60s for timeout 10s for reconnect
unsigned char buff[1024] = {0};
double pos[3] = {-2258208.214700, 5020578.919700, 3210256.397500}, enu[3] = {0};
SDK_init("kinematic", "", pos, enu, 7, 1.0);
pthread_t pid_s, pid_e;
pthread_create(&pid_s, NULL, pthread_ssr, NULL);
pthread_create(&pid_e, NULL, pthread_brd, NULL);
while (1)
{
int nread = strread(&m_unsyncConn, buff, 1024);
for (int i = 0; i < nread; ++i)
{
IO_inputObsData(buff[i]);
}
if (nread == 0)
sleepms(10);
}
}