| | |
| | | |
| | | void PlatformStatusChanged(uint32_t event, const uint8_t *data, int length) |
| | | { |
| | | pthread_mutex_lock(&events_mutex); |
| | | eventMask |= event; |
| | | pthread_mutex_unlock(&events_mutex); |
| | | |
| | | if (data != NULL && length > 0) { |
| | | int x = BitCount(event-1); |
| | | |
| | |
| | | eventData[x] = malloc(length); |
| | | memcpy(eventData[x], data, length); |
| | | eventDataLength[x] = length; |
| | | |
| | | // DEBUG("ADD %d len %d", x, length); |
| | | } |
| | | |
| | | pthread_mutex_lock(&events_mutex); |
| | | eventMask |= event; |
| | | pthread_mutex_unlock(&events_mutex); |
| | | |
| | | sem_post(&sem_status_changed); |
| | | } |
| | |
| | | |
| | | while (events > 0) { |
| | | int x = BitCount(((events - 1) ^ events) - 1); |
| | | |
| | | // DEBUG("FETCH %d len %d", x, eventDataLength[x]); |
| | | |
| | | PlatformChangeEntry(BV(x), (uint8_t *)eventData[x], eventDataLength[x]); |
| | | if (eventData[x] != NULL) { |
| | | free(eventData[x]); |
| | |
| | | MA_RtkPlatformLogin(data[0]); |
| | | } |
| | | if (events & GPS_UPDATE_EVT) { |
| | | DEBUG("GPS_UPDATE_EVT length %d", length); |
| | | const gpsStatus_t *gps = (gpsStatus_t *)data; |
| | | struct gpsBrief brief; |
| | | |
| | |
| | | RequestRtkDownload(gps, 1); |
| | | } |
| | | if (events & RTK_UPDATE_EVT) { |
| | | DEBUG("RTK_UPDATE_EVT length %d", length); |
| | | const rtk_info *rtk = (rtk_info *)data; |
| | | struct rtkBrief brief; |
| | | |