| | |
| | | uint32_t downloadRtk : 1; |
| | | } platformStatus; |
| | | |
| | | static struct event_queue_t { |
| | | uint32_t event; |
| | | int length; |
| | | void *data; |
| | | struct event_queue_t *next; |
| | | } *eventQueue; |
| | | |
| | | struct platformSocket exceptSocket, currSocket; |
| | | static uint32_t eventMask; |
| | | static void *eventData[32]; |
| | |
| | | static void TriggerHeartbeat(union sigval sig); |
| | | static void RequestRtkNoResp(union sigval sig); |
| | | |
| | | void AddEvnet(uint32_t event, const uint8_t *data, int length) |
| | | { |
| | | struct event_queue_t *p = eventQueue; |
| | | |
| | | while (p != NULL) { |
| | | struct event_queue_t *nw = (struct event_queue_t *)malloc(sizeof(struct event_queue_t)); |
| | | |
| | | nw->event = event; |
| | | nw->next = NULL; |
| | | nw->data = NULL; |
| | | nw->length = 0; |
| | | if (data != NULL && length > 0) { |
| | | nw->data = malloc(length); |
| | | nw->length = length; |
| | | } |
| | | } |
| | | } |
| | | |
| | | void InitPlatform(const uint8_t *phone, const char *domain_name, int port) |
| | | { |
| | | DEBUG("InitPlatform"); |
| | |
| | | pthread_mutex_init(&platform_tx_mutex, NULL); |
| | | pthread_mutex_init(&events_mutex, NULL); |
| | | |
| | | eventQueue = NULL; |
| | | |
| | | eventMask = 0; |
| | | memset(eventData, 0, sizeof(eventData)); |
| | | memset(eventDataLength, 0, sizeof(eventDataLength)); |