// ====================================================================== ListHookedDevice::Item::Item(IOHIDevice* d) : device_(d), deviceType_(DeviceType::UNKNOWN) { setDeviceIdentifier(); setDeviceType(); }
/************************************************************************************ * * ***********************************************************************************/ bool FocusLynxF2::Connect() /* Overide of connect() function * different for F2 or F1 focuser * F2 don't connect himself to the hub */ { configurationComplete = false; if (!lynxDriveF1->isConnected()) { if (!lynxDriveF1->Connect()) { DEBUG(INDI::Logger::DBG_SESSION, "Focus F1 should be connected before try to connect F2"); return false; } lynxDriveF1->setConnected(true, IPS_OK); lynxDriveF1->updateProperties(); } PortFD = lynxDriveF1->getPortFD(); //Get the socket descriptor open by focuser F1 connect() DEBUGF(INDI::Logger::DBG_SESSION, "F2 PortFD : %d", PortFD); int modelIndex = IUFindOnSwitchIndex(&ModelSP); if (ack()) { DEBUG(INDI::Logger::DBG_SESSION, "FocusLynx is online. Getting focus parameters..."); setDeviceType(modelIndex); SetTimer(POLLMS); return true; } DEBUG(INDI::Logger::DBG_SESSION, "Error retreiving data from FocusLynx, please ensure FocusLynx controller is powered and the port is correct."); return false; }
AddChannelIdToList::AddChannelIdToList(uint8_t channel, uint16_t deviceNumber, uint8_t deviceType, uint8_t transmissionType, uint8_t listIndex) : AntRequest(ADD_CHANNEL_ID_TO_LIST) { setChannel(channel); setDeviceNumber(deviceNumber); setDeviceType(deviceType); setTransmissionType(transmissionType); setListIndex(listIndex); }
void NodeIdentificationIndicator::setFrameData(QByteArray data) { int idx = 0, dataSize = data.size(); if ((dataSize < 32) && (data.at(0) != getFrameType())) return; setSourceAddress64(data.mid(1,8)); setSourceAddress16(data.mid(9,2)); setReceiveOptions(data[11]); setRemoteAddress16(data.mid(12,2)); setRemoteAddress64(data.mid(14,8)); idx = data.indexOf((char)0x00, 22); setNIString(data.mid(22,idx-22)); setParentAddress16(data.mid(idx+1, 2)); setDeviceType(data[idx+3]); setSourceEvent(data[idx+4]); setProfileID(data.mid(idx+5,2)); setManufacturerID(data.mid(idx+7,2)); if (dataSize > idx+9) { if (dataSize == idx+14) { setDeviceTypeID(data.mid(idx+9,4)); setRSSI(QByteArray(1,data[idx+13])); } else if (dataSize == idx+13) setDeviceTypeID(data.mid(idx+9,4)); else setRSSI(QByteArray(1, data[idx+9])); } }
// ====================================================================== ListHookedDevice::Item::Item(IOHIDevice* d) : device_(d), deviceType_(DeviceType::UNKNOWN), inProgress_(false) { setDeviceIdentifier(); setDeviceType(); }
/* C++ */ ArduinoiDigiInterfaceClass::ArduinoiDigiInterfaceClass() { memset(&_mac, 0, sizeof(_mac)); memset(&_ip, 0, sizeof(_ip)); memset(&_deviceId, 0, sizeof(_deviceId)); memset(&_vendorId, 0, sizeof(_vendorId)); setServerHost((const char *) IDIGI_DEFAULT_SERVERHOST); setDeviceType((const char *) IDIGI_DEFAULT_DEVICETYPE); _connectionType = idigi_lan_connection_type; _linkSpeed = IDIGI_DEFAULT_LINKSPEED; setPhoneNumber((const char *) IDIGI_DEFAULT_PHONENUMBER); idigi_handle = NULL; connected = false; }
void HmCcTc::loadVariables(BaseLib::Systems::ICentral* device, std::shared_ptr<BaseLib::Database::DataTable>& rows) { try { BidCoSPeer::loadVariables(device, rows); for(BaseLib::Database::DataTable::iterator row = rows->begin(); row != rows->end(); ++row) { _variableDatabaseIDs[row->second.at(2)->intValue] = row->second.at(0)->intValue; switch(row->second.at(2)->intValue) { case 1000: _currentDutyCycleDeviceAddress = row->second.at(3)->intValue; break; case 1004: _valveState = row->second.at(3)->intValue; break; case 1005: _newValveState = row->second.at(3)->intValue; break; case 1006: _lastDutyCycleEvent = row->second.at(3)->intValue; break; case 1007: _dutyCycleMessageCounter = (uint8_t)row->second.at(3)->intValue; break; } } setDeviceType((uint32_t)DeviceType::HMCCTC); startDutyCycle(calculateLastDutyCycleEvent()); } catch(const std::exception& ex) { GD::out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(BaseLib::Exception& ex) { GD::out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(...) { GD::out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__); } }
AppConfig::AppConfig() { setDeviceType(Tiger::DeviceType::kiPad); setCurLanguage(cocos2d::LanguageType::ENGLISH); setMusicEnable(true); setSFXEnable(true); setCurPlaneID(0); _curGotBadge.clear(); _curGotBadge[BadgeCategory::kCategory1] = {BADGE_CATEGORY1_TOTAL}; _curGotBadge[BadgeCategory::kCategory2] = {BADGE_CATEGORY2_TOTAL}; _curGotBadge[BadgeCategory::kCategory3] = {BADGE_CATEGORY3_TOTAL}; _curGotBadge[BadgeCategory::kCategory4] = {BADGE_CATEGORY4_TOTAL}; _curGotBadge[BadgeCategory::kCategory5] = {BADGE_CATEGORY5_TOTAL}; _curGotBadge[BadgeCategory::kCategory6] = {BADGE_CATEGORY6_TOTAL}; initUserDefault(); }
bool InputDeviceMapping::populateFromSettings(QSettings &s) { // retro device type QString device_type = s.value("device_type").toString(); if (device_type != "joypad") { // TODO: only supported type for now return false; } setDeviceType(RETRO_DEVICE_JOYPAD); auto *mapping = settings_mappings.value(device_type); for (auto i = mapping->constBegin(); i != mapping->constEnd(); i++) { QVariant val = s.value(i.key()); if (!val.isValid()) continue; QString eventstr = val.toString(); InputDeviceEvent *ev = eventFromString(eventstr); if (ev != nullptr) setMapping(ev, i.value()); } return true; }
void AppConfig::setAppConfig() { Size win_size = Director::getInstance()->getWinSize(); #if CC_TARGET_PLATFORM == CC_PLATFORM_IOS if ((int)win_size.width % 1024 == 0 || (int)win_size.height % 1024 == 0) { // this is iPad if (win_size.width > 1024 || win_size.height > 1024) { // air, air2, mini retina setDeviceType(Tiger::DeviceType::kiPad_Retina); FileUtils::getInstance()->addSearchPath("image/2048/"); }else { // ipad2, mini setDeviceType(Tiger::DeviceType::kiPad); FileUtils::getInstance()->addSearchPath("image/1024/"); } }else if ((int)win_size.width == 960) { setDeviceType(Tiger::DeviceType::kiPhpne4s); FileUtils::getInstance()->addSearchPath("image/1024/"); }else if((int)win_size.width == 1136) { setDeviceType(Tiger::DeviceType::kiPhone5); FileUtils::getInstance()->addSearchPath("image/1024/"); }else if ((int)win_size.width == 1334) { setDeviceType(Tiger::DeviceType::kiphone6); FileUtils::getInstance()->addSearchPath("image/1024/"); }else if ((int)win_size.width >= 1920) { setDeviceType(Tiger::DeviceType::kiphone6plus); FileUtils::getInstance()->addSearchPath("image/2048/"); } #elif CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID if ((int)win_size.width % 1024 == 0 || (int)win_size.height % 1024 == 0) { // 4 : 3, as Mi Pad. setDeviceType(Tiger::DeviceType::kiPad); FileUtils::getInstance()->addSearchPath("image/1024/"); }else if((int)win_size.width >= 1920) { // 16 : 9, as 1920 x 1080 setDeviceType(Tiger::DeviceType::kAndroid_HD); FileUtils::getInstance()->addSearchPath("image/1024/"); }else { // as 1280 x 720 setDeviceType(Tiger::DeviceType::kAndroid_SD); FileUtils::getInstance()->addSearchPath("image/1024/"); } #endif Size desgin_size = getDesginResoucesSizeByDevice(); Director::getInstance()->getOpenGLView()->setDesignResolutionSize(desgin_size.width, desgin_size.height, ResolutionPolicy::FIXED_HEIGHT); }
// ====================================================================== ListHookedDevice::Item::Item(IOHIDevice* d) : device_(d), vendor_(0), product_(0), deviceType_(DeviceType::UNKNOWN) { setVendorProduct(); setDeviceType(); }
bool InputDeviceMapping::populateFromDict(QVariantMap deviceinfo) { setDeviceType(RETRO_DEVICE_JOYPAD); // TODO return true; }
Fan::Fan(int speed, int range): proSpeed(speed), proRange(range) { setDeviceName("Coolers Fan"); setDeviceType(MOTOR); }
Temperature::Temperature() { setDeviceName("Temperature Sensor"); setDeviceType(SENSOR); setAddr(ADC_BG_ADDRESS); }
int MainWindow::createOceanDataViewFile( QStringList &sl_MetadataList, QStringList &sl_ParameterList, const QString &s_FilenameOut, const int i_CodecInput, const int i_Env, const int i_DeviceTypeOceanDataView, const bool b_showShortName, const bool b_showMethod, const bool b_showComment, const bool b_usePANGAEAQualityFlags, const bool b_setGeocode, const bool b_addLineNo, const float f_GEOCODE_min, const float f_GEOCODE_max, const QString &s_GEOCODE_min, const QString &s_GEOCODE_max, const bool b_setGearID, const int i_GearID, const int i_NumOfFiles ) { QVector<int> vi_pos; QVector<int> vi_posQV; QVector<int> vi_SpecialPos; int i_NumOfRemovedLines = 0; int i_NumOfHeaderItems = 0; int i_GeocodePos = -1; int i_GearIDPos = -1; int i_File = 0; int i_stopFileProgress = 0; int stopProgress = 0; int err = _NOERROR_; int i = 0; int n = 0; bool b_containsDOI = false; QString s_FieldDelimiter = "\t"; QString s_Environment = ""; QString s_DeviceType = "*"; QString s_Output = ""; QString s_FilenameIn = sl_MetadataList.at( 1 ).section( "\t", _FILENAMEPOS, _FILENAMEPOS ); QStringList sld_ParameterList; QStringList sl_Input; QStringList sl_Output; QDateTime dt_GEOCODE_min( QDateTime::fromString( (QString) s_GEOCODE_min, Qt::ISODate ) ); QDateTime dt_GEOCODE_max( QDateTime::fromString( (QString) s_GEOCODE_max, Qt::ISODate ) ); //----------------------------------------------------------------------------------------------------------------------- if ( sl_ParameterList.count() == 0 ) return( -60 ); //----------------------------------------------------------------------------------------------------------------------- i_NumOfHeaderItems = buildODVHeader( sl_Output, sl_ParameterList, vi_posQV, i_Env, b_showShortName, b_showMethod, b_showComment, b_usePANGAEAQualityFlags ); if ( i_NumOfHeaderItems < 0 ) return( i_NumOfHeaderItems ); // return as error, -70 = Latitude/Longitude not given, -71 = Latitude not given, -72 = Longitude not given //----------------------------------------------------------------------------------------------------------------------- QFile ftext( s_FilenameOut ); if ( ftext.open( QIODevice::WriteOnly | QIODevice::Text) == false ) return( -20 ); QTextStream tout( &ftext ); //----------------------------------------------------------------------------------------------------------------------- initFileProgress( i_NumOfFiles, s_FilenameIn, tr( "Creating Ocean Data View file..." ) ); //----------------------------------------------------------------------------------------------------------------------- // write header tout << "//<Version>ODV Spreadsheet V4.0</Version>" << endl; tout << "//<Creator>" << "</Creator>" << endl; tout << "//<CreateTime>" << QDateTime::currentDateTime().toString( "yyyy-MM-ddThh:mm" ) << "</CreateTime>" << endl; tout << "//<Software>" << getApplicationName( true ) << " " << _VERSION_ << "</Software>" << endl; tout << "//<Source>" << QDir::toNativeSeparators( s_FilenameOut ) << "</Source>" << endl; tout << "//<SourceLastModified>" << QDateTime::currentDateTime().toString( "yyyy-MM-ddThh:mm" ) << "</SourceLastModified>" << endl; tout << "//<DataField>GeneralField</DataField>" << endl; tout << "//<DataType>GeneralType</DataType>" << endl; tout << "//" << endl; //----------------------------------------------------------------------------------------------------------------------- i_GeocodePos = getGeocodePosition( sl_ParameterList, i_Env ); i_GearIDPos = getGearIDPosition( sl_ParameterList ); b_containsDOI = sl_Output.contains( "DOI:METAVAR:TEXT:51" ); tout << sl_Output.join( s_FieldDelimiter ) << endl; //----------------------------------------------------------------------------------------------------------------------- // find position of date/time parameters getSpecialPos( sl_ParameterList, vi_SpecialPos ); //----------------------------------------------------------------------------------------------------------------------- s_DeviceType = setDeviceType( i_DeviceTypeOceanDataView ); //----------------------------------------------------------------------------------------------------------------------- i_File = 1; while ( ( i_File <= i_NumOfFiles ) && ( err == _NOERROR_ ) && ( i_stopFileProgress != _APPBREAK_ ) ) { if ( containsSelectedEnvironment( _SELECTPARAMETER, sl_MetadataList.at( i_File ).section( "\t", _ENVIRONMENTPOS, _ENVIRONMENTPOS ).toInt(), i_Env ) == true ) { s_FilenameIn = sl_MetadataList.at( i_File ).section( "\t", _FILENAMEPOS, _FILENAMEPOS ); if ( ( n = readFile( s_FilenameIn, sl_Input, i_CodecInput ) ) > 0 ) { i = 0; sld_ParameterList.clear(); vi_pos.clear(); initProgress( i_NumOfFiles, s_FilenameIn, tr( "Ocean Data View converter is working..." ), n ); setStatusBarFileInProgress( s_FilenameIn ); //----------------------------------------------------------------------------------------------------------------------- // read header and find position of parameter s_Environment = sl_MetadataList.at( i_File ).section( "\t", _ENVIRONMENTPOS, _ENVIRONMENTPOS ) + _PSEPARATOR_; stopProgress = incProgress( i_NumOfFiles, i ); if ( sl_Input.at( i ).startsWith( "/* DATA DESCRIPTION:" ) == true ) // file starts with PANGAEA header { while ( ( i < n ) && ( sl_Input.at( i ).startsWith( "*/" ) == false ) ) { if ( sl_Input.at( i ).startsWith( "Parameter(s):" ) == true ) { while ( ( i < n ) && ( ( sl_Input.at( i ).startsWith( "Parameter(s):" ) == true ) || ( sl_Input.at( i ).startsWith( "\t" ) == true ) ) ) { sld_ParameterList.append( s_Environment + buildParameter( sl_Input.at( i ).section( "\t", 1, 1 ) ) ); if ( ++i < n ) stopProgress = incProgress( i_NumOfFiles, i ); } } if ( ++i < n ) stopProgress = incProgress( i_NumOfFiles, i ); } for ( int j=0; j<sl_ParameterList.count(); ++j ) vi_pos.append( containsParameter( true, sld_ParameterList, sl_ParameterList.at( j ), b_showShortName, b_showMethod, b_showComment ) ); if ( ++i < n ) stopProgress = incProgress( i_NumOfFiles, i ); } else { sld_ParameterList = buildParameterList( s_Environment, sl_Input.at( i ) ); // not a PANGAEA dataset for ( int j=0; j<sl_ParameterList.count(); ++j ) vi_pos.append( containsParameter( false, sld_ParameterList, sl_ParameterList.at( j ), b_showShortName, b_showMethod, b_showComment ) ); } //----------------------------------------------------------------------------------------------------------------------- // write output string if ( ( b_setGeocode == true ) || ( b_setGearID == true ) ) { while ( ( ++i < n ) && ( stopProgress != _APPBREAK_ ) ) { sl_Output = buildODVOutputStr( i+1, b_addLineNo, sl_Input.at( i ), sl_MetadataList.at( i_File ), vi_pos, vi_posQV, vi_SpecialPos, b_usePANGAEAQualityFlags, b_containsDOI, s_DeviceType, s_FieldDelimiter ); if ( writeDataLine( b_setGeocode, b_setGearID, i_GeocodePos, i_GearIDPos, sl_Output, i_Env, dt_GEOCODE_min, dt_GEOCODE_max, f_GEOCODE_min, f_GEOCODE_max, i_GearID ) == true ) { s_Output = sl_Output.join( s_FieldDelimiter ); if ( s_Output.contains( "delete line" ) == false ) tout << s_Output << endl; else ++i_NumOfRemovedLines; } stopProgress = incProgress( i_NumOfFiles, i ); } } else { while ( ( ++i < n ) && ( stopProgress != _APPBREAK_ ) ) { sl_Output = buildODVOutputStr( i+1, b_addLineNo, sl_Input.at( i ), sl_MetadataList.at( i_File ), vi_pos, vi_posQV, vi_SpecialPos, b_usePANGAEAQualityFlags, b_containsDOI, s_DeviceType, s_FieldDelimiter ); s_Output = sl_Output.join( s_FieldDelimiter ); if ( s_Output.contains( "delete line" ) == false ) tout << s_Output << endl; else ++i_NumOfRemovedLines; stopProgress = incProgress( i_NumOfFiles, i ); } } resetProgress( i_NumOfFiles ); } } i_stopFileProgress = incFileProgress( i_NumOfFiles, i_File++ ); } //----------------------------------------------------------------------------------------------------------------------- resetFileProgress( i_NumOfFiles ); ftext.close(); return( i_NumOfRemovedLines ); }
void ArduinoiDigiInterfaceClass::setup(uint8_t *mac, IPAddress ip, uint32_t vendorId, char *serverHost, char *deviceType) { setDeviceType(deviceType); setup(mac, ip, vendorId, serverHost); }