int main(int argc, char *argv[]) { move_daemon moved; #ifdef __linux moved_monitor *monitor = moved_monitor_new(on_monitor_update_moved, &moved); #endif /* Never act as a client in "moved" mode */ psmove_set_remote_config(PSMove_OnlyLocal); moved.dump_devices(); int id, count = psmove_count_connected(); for (id=0; id<count; id++) { moved.handle_connection(NULL, NULL); } #ifdef __linux fd_set fds; int server_fd = moved.get_socket(); int monitor_fd = moved_monitor_get_fd(monitor); int nfds = ((server_fd > monitor_fd)?(server_fd):(monitor_fd)) + 1; #endif for (;;) { #ifdef __linux FD_ZERO(&fds); FD_SET(server_fd, &fds); FD_SET(monitor_fd, &fds); if (select(nfds, &fds, NULL, NULL, NULL)) { if (FD_ISSET(monitor_fd, &fds)) { moved_monitor_poll(monitor); } if (FD_ISSET(server_fd, &fds)) { moved.handle_request(); } } #else moved.handle_request(); #endif moved.write_reports(); } #ifdef __linux moved_monitor_free(monitor); #endif return 0; }
PSMoveManager::PSMoveManager () { psmove_set_remote_config (PSMove_OnlyLocal); }