/** * Main function. */ int main(int argc, char *argv[]) { char *fileName; const char fileMode[] = "r+"; unsigned int baud; int fd; fileName = getDeviceFileName(argc, argv); fd = openDeviceFile(fileName, fileMode); baud = getBaudRate(argc, argv); setAttr(fd, baud); displayResult(fd); sendCommand(fd, "?"); displayResult(fd); sound(fd*10); printf("\n"); nosound(); close(fd); return EXIT_SUCCESS; }
int main(int argc, char* argv[]) { XnBool bChooseDevice = false; const char* csRecordingName = NULL; if (argc > 1) { if (strcmp(argv[1], "-devices") == 0) { bChooseDevice = TRUE; } else { csRecordingName = argv[1]; } } if (csRecordingName != NULL) { // check if running from a different directory. If so, we need to change directory // to the real one, so that path to INI file will be OK (for log initialization, for example) if (0 != changeDirectory(argv[0])) { return(ERR_DEVICE); } } // Xiron Init XnStatus rc = XN_STATUS_OK; EnumerationErrors errors; if (csRecordingName != NULL) { xnLogInitFromXmlFile(SAMPLE_XML_PATH); rc = openDeviceFile(argv[1]); } else if (bChooseDevice) { rc = openDeviceFromXmlWithChoice(SAMPLE_XML_PATH, errors); } else { rc = openDeviceFromXml(SAMPLE_XML_PATH, errors); } if (rc == XN_STATUS_NO_NODE_PRESENT) { XnChar strError[1024]; errors.ToString(strError, 1024); printf("%s\n", strError); closeSample(ERR_DEVICE); return (rc); } else if (rc != XN_STATUS_OK) { printf("Open failed: %s\n", xnGetStatusString(rc)); closeSample(ERR_DEVICE); } captureInit(); statisticsInit(); //reshaper.zNear = 1; //reshaper.zFar = 100; //glut_add_interactor(&reshaper); //cb.mouse_function = MouseCallback; //cb.motion_function = MotionCallback; //cb.passive_motion_function = MotionCallback; //cb.keyboard_function = KeyboardCallback; //cb.reshape_function = ReshapeCallback; //glut_add_interactor(&cb); glutInit(&argc, argv); glutInitDisplayString("stencil double rgb"); glutInitWindowSize(WIN_SIZE_X, WIN_SIZE_Y); glutCreateWindow("OpenNI Viewer"); //glutFullScreen(); glutSetCursor(GLUT_CURSOR_NONE); glutMouseFunc(MouseCallback); glutMotionFunc(MotionCallback); init_opengl(); glutIdleFunc(IdleCallback); glutDisplayFunc(drawFunctionMain); glutPassiveMotionFunc(MotionCallback); //createKeyboardMap(); //createMenu(); atexit(onExit); //Use built in hand tracker class to handle all hand movements and gestures HandTracker mainHandTracker(g_Context); m_HandTracker = &mainHandTracker; drawInit(m_HandTracker); //mainHandTracker.Init(); //mainHandTracker.Run(); xn::ImageGenerator test; g_Context.FindExistingNode(XN_NODE_TYPE_IMAGE, test); xn::DepthGenerator depth; g_Context.FindExistingNode(XN_NODE_TYPE_DEPTH, depth); depth.GetAlternativeViewPointCap().SetViewPoint(test); glutMainLoop(); return 0; }