static int ts_gps_core_reconfigure(void) { struct pollfd pfd = {}; int timeout_ms; int ret; /* Get new poll setup. */ ret = ubgps_poll_setup(ts_gps, &pfd, &timeout_ms); if (ret < 0) { return ret; } /* Reconfigure poll events. */ if (ts_core_gps.fd >= 0) ts_core_fd_unregister(ts_core_gps.fd); if (pfd.fd >= 0) { ret = ts_core_fd_register(pfd.fd, pfd.events, ts_gps_poll_callback, NULL); DEBUGASSERT(ret >= 0); } ts_core_gps.fd = pfd.fd; /* Reconfigure timers. */ if (ts_core_gps.timerid >= 0) ts_core_timer_stop(ts_core_gps.timerid); if (timeout_ms >= 0) { ret = ts_core_timer_setup(TS_TIMER_TYPE_TIMEOUT, timeout_ms, ts_gps_timer_callback, NULL); DEBUGASSERT(ret >= 0); ts_core_gps.timerid = ret; } else { ts_core_gps.timerid = -1; } return OK; }
int __exapp_connectivity_init(void) { int ret = OK; char *config; ret = create_conman_config(&config); if (ret < 0) { exapp_dbg("create_config failed\n"); return ERROR; } ret = conman_client_init_events(&g_conman_client, conman_events_cb, NULL); if (ret != OK) { exapp_dbg("conman_client_init_events failed\n"); return ERROR; } ret = conman_client_set_connections_config(&g_conman_client, config); free(config); if (ret != OK) { exapp_dbg("conman_client_set_connections_config failed\n"); return ERROR; } ret = ts_core_fd_register(g_conman_client.sd, POLLIN, conman_client_pollfd, NULL); if (ret != OK) { exapp_dbg("ts_core_fd_register failed\n"); return ERROR; } return ret; }