print.cpp
Go to the documentation of this file.
00001 /*********************************************************************
00002 *
00003 * This is free and unencumbered software released into the public domain.
00004 * 
00005 * Anyone is free to copy, modify, publish, use, compile, sell, or
00006 * distribute this software, either in source code form or as a compiled
00007 * binary, for any purpose, commercial or non-commercial, and by any
00008 * means.
00009 * 
00010 * In jurisdictions that recognize copyright laws, the author or authors
00011 * of this software dedicate any and all copyright interest in the
00012 * software to the public domain. We make this dedication for the benefit
00013 * of the public at large and to the detriment of our heirs and
00014 * successors. We intend this dedication to be an overt act of
00015 * relinquishment in perpetuity of all present and future rights to this
00016 * software under copyright law.
00017 * 
00018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00019 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00020 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00021 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00022 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00023 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00024 * OTHER DEALINGS IN THE SOFTWARE.
00025 * 
00026 * For more information, please refer to <http://unlicense.org/>
00027 * 
00028 **********************************************************************/
00029 #include <cstdio>
00030 #include <signal.h>
00031 #include "razer_hydra/hydra.h"
00032 
00033 using namespace razer_hydra;
00034 
00035 static bool g_done = false;
00036 void sigint_handler(int signal)
00037 {
00038     g_done = true;
00039 }
00040 
00041 int main(int argc, char **argv)
00042 {
00043   if (argc != 2)
00044   {
00045     printf("usage: print DEVICE\n");
00046     return 1;
00047   }
00048   signal(SIGINT, sigint_handler);
00049   RazerHydra h;
00050   if (!h.init(argv[1]))
00051     return 1;
00052 
00053   printf("Finished initializing, now printing data stream:\n");
00054 
00055   while (!g_done)
00056   {
00057     if (h.poll(10, 100))
00058     {
00059       printf("%.3f %.3f %.3f      %.3f %.3f %.3f\n",
00060              h.pos[0].x(), h.pos[0].y(), h.pos[0].z(),
00061              h.pos[1].x(), h.pos[1].y(), h.pos[1].z());
00062     }
00063   }
00064   return 0;
00065 }
00066 


razer_hydra
Author(s): Adam Leeper
autogenerated on Fri Aug 28 2015 12:21:51