//------------------------------------------------------------------------------ int main(int argc, char *argv[]) { GMainLoop *loop; GError * err = NULL; // Sensors Sensors s; s.scan(); // Bluetooth scan // Bluetooth b; b.scan(); #if 0 GIOChannel *channel = g_io_channel_unix_new(b.Handle()); g_io_add_watch(channel, (GIOCondition)(G_IO_IN | G_IO_OUT | G_IO_ERR | G_IO_HUP), onEvent, channel); #endif //b.close(); // socket server // GSocketService * server = g_socket_service_new(); g_socket_listener_add_inet_port((GSocketListener*)server, PORT, NULL, &err); if (err != NULL) { g_error("ERROR: %s", err->message); } g_signal_connect (server, "incoming", G_CALLBACK(onConnection), NULL); g_socket_service_start(server); // mainloop and timer // loop = g_main_loop_new ( NULL , FALSE ); g_timeout_add (5000 , OnTimer , loop); g_main_loop_run (loop); g_main_loop_unref(loop); return 0; }