| | |
| | | // Created by YY on 2020/1/20. |
| | | // |
| | | |
| | | #include <pthread.h> |
| | | #include <cstdlib> |
| | | #include <cstring> |
| | | #include "virtual_rtk.h" |
| | |
| | | static void TcpEventCallback2(int stat, void *p, void *context); |
| | | static void TcpDataCallback2(void *buffer, int length, void *p, void *context); |
| | | |
| | | static void ConnectLater(union sigval sig); |
| | | static void ConnectLater2(union sigval sig); |
| | | static void ConnectLater(apptimer_var_t val); |
| | | static void ConnectLater2(apptimer_var_t val); |
| | | |
| | | void InitVirtualDevice(const char *domain_name, int port) |
| | | { |
| | |
| | | return temp; |
| | | } |
| | | |
| | | static void ConnectLater(union sigval sig) { |
| | | AppTimer_delete(ConnectLater); |
| | | |
| | | static void ConnectLater(apptimer_var_t val) { |
| | | if (ctp != NULL) { |
| | | ctp->OpenTcpPort(VAddr.domain_name, VAddr.port); |
| | | } |
| | | } |
| | | |
| | | static void ConnectLater2(union sigval sig) |
| | | static void ConnectLater2(apptimer_var_t val) |
| | | { |
| | | AppTimer_delete(ConnectLater2); |
| | | |
| | | if (ctp2 != NULL) { |
| | | ctp2->OpenTcpPort(VAddr.domain_name, VAddr.port + 1); |
| | | } |
| | |
| | | RxBufLen += length; |
| | | |
| | | if (RxBufLen > 0) { |
| | | ParseMcu(RxBuf, RxBufLen); |
| | | /////////////////ParseMcu(RxBuf, RxBufLen); |
| | | RxBufLen = 0; |
| | | } |
| | | } |