/* Copyright (C) 2006 Cole Krumbholz */ /* */ /* This is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ /* General Public License for more details. */ #include "tabletracker.h" #include #include #define TIMEOUT 3000 int main(int argc, char *argv[]) { int id, type; double xpos, ypos, angle; if (argc < 2) { printf("usage: testtabletracker [PORT]\n"); return 0; } printf("opening connection via port %d\n", atoi(argv[1])); if (TT_open(atoi(argv[1])) != TT_OK) { printf("error opening socket for tracker data\n"); return 0; } printf("waiting for messages from tracker\n"); while (TT_poll(TIMEOUT)) { TT_get(&id, &xpos, &ypos, &angle, &type); printf("id: %d, xpos: %.2f, ypos: %.2f, angle: %.2f, type: %d\n", id, xpos, ypos, angle, type); } printf("no messages, exiting\n"); TT_close(); return 0; }