// ***************************************************************************** // constructor: DSPNode::DSPNode (SceneManager *sceneManager, char *initID) : GroupNode(sceneManager, initID) { nodeType = "DSPNode"; // enable report of globals by default: setReportMode(GroupNode::GLOBAL_6DOF); // connection stuff: connectTO.clear(); connectFROM.clear(); active = 1; plugin = "empty~"; _rolloff = "default"; _spread = 1.0f; _length = 10.0f; directivityFlag = 0; laserFlag = 0; VUmeterFlag = 0; currentSoundIntensity = 0.0; currentSoundColor = osg::Vec3(0.0,1.0,0.0); //green directivityColor = osg::Vec4(DEFAULT_DIRECTIVITY_COLOR,1.0); // OSG Stuff: laserGeode = NULL; directivityGeode = NULL; VUmeterTransform = NULL; }
//--------------------------------------------------------------------------- bool TRig::openOak(void) { EOakStatus status; unsigned int rate = 100; if(isOakOpen()) return true; if(oak_device.isEmpty()) { qDebug("Empty path to HID device"); return false; } if(!checkOak(openDevice(oak_device.toStdString(), oakHandle))) return false; if(!checkOak(getDeviceInfo(oakHandle, oakDevInfo))) return false; else if(oakDevInfo.numberOfChannels < 4) { qDebug("Inclinometer should have 4 channels found %d", oakDevInfo.numberOfChannels); closeOak(); return false; } // Set the report Mode if(!checkOak(setReportMode(oakHandle, eReportModeAfterSampling, true))) //if(!checkOak(setReportMode(oakHandle, eReportModeFixedRate, true))) //if(!checkOak(setReportMode(oakHandle, eReportModeAfterChange, true))) return false; // Set the report rate // This parameter will only be regarded if Report Mode = 2 (fixed rate) if(!checkOak(setReportRate(oakHandle, rate, true))) return false; // Set the sample rate if(!checkOak(setSampleRate(oakHandle, rate, true))) //if(!checkOak(setSampleRate(oakHandle, rate * 2, true))) return false; // get channel 3 (zenith angle) info status = getChannelInfo(oakHandle, 2, oakChannelInfo[0]); // get channel 4 (azimuth angle) info if(status == eOakStatusOK) status = getChannelInfo(oakHandle, 3, oakChannelInfo[1]); if(!checkOak(status)) return false; return true; }
/***************************************************************************** * oak_digin_setup(..) *****************************************************************************/ int oak_digin_setup(int* deviceHandle, char* oakDiginDevice) { int oak_stat; oak_stat = CHECK_OAK_CALL(openDevice(oakDiginDevice, deviceHandle)); if (oak_stat != 0) return oak_stat; // get the device informations oak_stat = CHECK_OAK_CALL(getDeviceInfo(oakDiginHandle, &devInfo)); if (oak_stat != 0) return oak_stat; /* fprintf( stderr, "oak_digin_setup: Oak device: %s\n", devInfo.deviceName); */ /* fprintf( stderr, "oak_digin_setup: Volatile user device name: %s\n", devInfo.volatileUserDeviceName); */ /* fprintf( stderr, "oak_digin_setup: Persistent user device name: %s\n", devInfo.persistentUserDeviceName); */ /* fprintf( stderr, "oak_digin_setup: Serial number: %s\n", devInfo.serialNumber); */ /* fprintf( stderr, "oak_digin_setup: VendorID: 0x%.4x :: ProductID: 0x%.4x :: Version 0x%.4x\n", devInfo.vendorID, devInfo.productID, devInfo.version); */ /* fprintf( stderr, "oak_digin_setup: Number of channels: %d\n", devInfo.numberOfChannels); */ if (strcmp(devInfo.deviceName, "Toradex Optical Isolated Input")) { return -1; } // Set the LED Mode to indicate initialize state oak_stat = CHECK_OAK_CALL( setLedMode(*deviceHandle, eLedModeBlinkFast, false)); if (oak_stat != 0) return oak_stat; // Set the report Mode oak_stat = CHECK_OAK_CALL(setReportMode(*deviceHandle, eReportModeAfterSampling, false)); if (oak_stat != 0) return oak_stat; // Set the sample rate oak_stat = CHECK_OAK_CALL( setSampleRate(*deviceHandle, 50, false)); if (oak_stat != 0) return oak_stat; // Retrieve Channel infos /* wildi ToDo * ChannelInfo* channelInfos = xmalloc(devInfo.numberOfChannels *sizeof(ChannelInfo)); * ChannelInfo* chanInfo; * chanInfo = &channelInfos[1]; */ return 0; }