void MSOpenH264Encoder::setBitrate(int bitrate) { if (isInitialized()) { // Encoding is already ongoing, do not change video size, only bitrate. mVConf.required_bitrate = bitrate; setConfiguration(mVConf); } else { MSVideoConfiguration best_vconf = ms_video_find_best_configuration_for_bitrate(mVConfList, bitrate, ms_get_cpu_count()); setConfiguration(best_vconf); } }
PertyDuplicatePoiOp::PertyDuplicatePoiOp() { _localRng.reset(new boost::minstd_rand(1)); _rng = _localRng.get(); setConfiguration(conf()); }
Type::Type(void) { obj_type=OBJ_TYPE; setConfiguration(ENUMERATION_TYPE); attributes[ParsersAttributes::BASE_TYPE]=QString(); attributes[ParsersAttributes::COMPOSITE_TYPE]=QString(); attributes[ParsersAttributes::RANGE_TYPE]=QString(); attributes[ParsersAttributes::TYPE_ATTRIBUTE]=QString(); attributes[ParsersAttributes::ENUM_TYPE]=QString(); attributes[ParsersAttributes::ENUMERATIONS]=QString(); attributes[ParsersAttributes::INPUT_FUNC]=QString(); attributes[ParsersAttributes::OUTPUT_FUNC]=QString(); attributes[ParsersAttributes::RECV_FUNC]=QString(); attributes[ParsersAttributes::SEND_FUNC]=QString(); attributes[ParsersAttributes::TPMOD_IN_FUNC]=QString(); attributes[ParsersAttributes::TPMOD_OUT_FUNC]=QString(); attributes[ParsersAttributes::ANALYZE_FUNC]=QString(); attributes[ParsersAttributes::INTERNAL_LENGTH]=QString(); attributes[ParsersAttributes::BY_VALUE]=QString(); attributes[ParsersAttributes::ALIGNMENT]=QString(); attributes[ParsersAttributes::STORAGE]=QString(); attributes[ParsersAttributes::DEFAULT_VALUE]=QString(); attributes[ParsersAttributes::ELEMENT]=QString(); attributes[ParsersAttributes::DELIMITER]=QString(); attributes[ParsersAttributes::REDUCED_FORM]=QString(); attributes[ParsersAttributes::CATEGORY]=QString(); attributes[ParsersAttributes::PREFERRED]=QString(); attributes[ParsersAttributes::LIKE_TYPE]=QString(); attributes[ParsersAttributes::COLLATABLE]=QString(); attributes[ParsersAttributes::SUBTYPE]=QString(); attributes[ParsersAttributes::SUBTYPE_DIFF_FUNC]=QString(); attributes[ParsersAttributes::CANONICAL_FUNC]=QString(); attributes[ParsersAttributes::OP_CLASS]=QString(); }
ConstrainedMatches::ConstrainedMatches(const ConstOsmMapPtr &map) : _map(map) { _score = -1; _timeLimit = -1; setConfiguration(conf()); }
void CanIO::loadConfiguration() { CanIOConfiguration *config = (CanIOConfiguration *) getConfiguration(); if (!config) { // as lowest sub-class make sure we have a config object config = new CanIOConfiguration(); setConfiguration(config); } Device::loadConfiguration(); // call parent Logger::info(this, "CAN I/O configuration:"); #ifdef USE_HARD_CODED if (false) { #else if (prefsHandler->checksumValid()) { //checksum is good, read in the values stored in EEPROM #endif // prefsHandler->read(EESYS_, &config->); } else { // config-> = 0; saveConfiguration(); } // Logger::info(getId(), "xyz: %d", config->); } void CanIO::saveConfiguration() { // prefsHandler->write(EESYS_, config->); prefsHandler->saveChecksum(); }
PertyRemoveTagVisitor::PertyRemoveTagVisitor() { _localRng.reset(new boost::minstd_rand()); _rng = _localRng.get(); setConfiguration(conf()); }
bool Device::processSetupInRequest(SetupPacket * request, uint8_t * transferBuffer, uint16_t * transferBufferLength, uint16_t transferBufferMaxLength) { // Device only handles standard requests. if (request->requestType() != SetupPacket::RequestType::Standard) { return false; } switch (request->bRequest()) { case (int) Request::GetStatus: return getStatus(transferBuffer, transferBufferLength, transferBufferMaxLength); case (int) Request::SetAddress: // Make sure the request is adress is valid. assert(request->wValue() < 128); /* According to the reference manual, the address should be set after the * Status stage of the current transaction, but this is not true. * It should be set here, after the Data stage. */ setAddress(request->wValue()); *transferBufferLength = 0; return true; case (int) Request::GetDescriptor: return getDescriptor(request, transferBuffer, transferBufferLength, transferBufferMaxLength); case (int) Request::SetConfiguration: *transferBufferLength = 0; return setConfiguration(request); case (int) Request::GetConfiguration: return getConfiguration(transferBuffer, transferBufferLength); } return false; }
std::shared_ptr<Node> NodeStore::registerNode(const NodeType type, const std::string className, const std::string name, const ont::entity entity, const ont::entity entityRelated, std::map<std::string, std::string> config, const std::string source) { auto node = this->getNode(name, entity); if (node) { _log->info("Node '%v' already registered for entity '%v' / '%v'", name, entity, entityRelated); return node; } auto desc = std::make_shared<NodeDescription>(type, className, name, entity, entityRelated); if (type == NodeType::SOURCE) { desc->setSource(source); } node = Node::createNode(className); if (false == node) { _log->error("Node '%v' could not be created for entity '%v'. Register missing?", name, entity); return node; } node->setNodeDescription(desc); node->setConfiguration(config); return node; }
/** * Creates instances of BasicBehaviours, needed according to the PlanRepository, with the help of the given * BehaviourCreator. If a BasicBehaviour cannot be instantiated, the Initialisation of the Pool is cancelled. * @param bc A BehaviourCreator. * @return True, if all necessary BasicBehaviours could be constructed. False, if the Initialisation was cancelled. */ bool BehaviourPool::init(IBehaviourCreator* bc) { if (_behaviourCreator != nullptr) { delete _behaviourCreator; } _behaviourCreator = bc; const PlanRepository::Accessor<BehaviourConfiguration>& behaviourConfs = _ae->getPlanRepository()->getBehaviourConfigurations(); for (const BehaviourConfiguration* beh : behaviourConfs) { auto basicBeh = _behaviourCreator->createBehaviour(beh->getId()); if (basicBeh != nullptr) { // set stuff from behaviour configuration in basic behaviour object basicBeh->setConfiguration(beh); basicBeh->setDelayedStart(beh->getDeferring()); basicBeh->setInterval(1000 / beh->getFrequency()); basicBeh->setEngine(_ae); basicBeh->init(); _availableBehaviours.insert(make_pair(beh, basicBeh)); } else { return false; } } return true; }
void MLX90621::initialise(int refrate) { refreshRate = refrate; Wire.begin(I2C_MASTER, 0, I2C_PINS_18_19, I2C_PULLUP_INT, I2C_RATE_100); delay(5); readEEPROM(); writeTrimmingValue(); setConfiguration(); }
void MSOpenH264Encoder::setSize(MSVideoSize size) { MSVideoConfiguration best_vconf = ms_video_find_best_configuration_for_size(mVConfList, size, ms_get_cpu_count()); mVConf.vsize = size; mVConf.fps = best_vconf.fps; mVConf.bitrate_limit = best_vconf.bitrate_limit; setConfiguration(mVConf); }
OgrWriter::OgrWriter(): _currElementCacheCapacity(_maxCacheElementsPerTypeDefault), _elementCache(new ElementCacheLRU(_currElementCacheCapacity)), _wgs84() { setConfiguration(conf()); _wgs84.SetWellKnownGeogCS("WGS84"); }
PertyWaySplitVisitor::PertyWaySplitVisitor() : _splitRecursionLevel(0) { _localRng.reset(new boost::minstd_rand()); _rng = _localRng.get(); setConfiguration(conf()); }
AS3935::AS3935(PinName sda, PinName scl, PinName irqPin,int i2cFrequencyHz,uint8_t address):mI2c(sda,scl),mI2cAddr(address),mIrqPinInterrupt(irqPin) { queue =new Queue<uint8_t, 10>(); mI2c.frequency(i2cFrequencyHz); if(!setConfiguration()) while(1); //TODO handle error mIrqPinInterrupt.rise(this,&AS3935::handleIrqInterrupt); }
void BrcmPatchRAM::uploadFirmware() { // signal to timer that firmware already loaded mDevice.setProperty(kFirmwareLoaded, true); // don't bother with devices that have no firmware if (!getProperty(kFirmwareKey)) return; if (!mDevice.open(this)) { AlwaysLog("uploadFirmware could not open the device!\n"); return; } //REVIEW: this block to avoid merge conflicts (remove once merged) ////if (mDevice.open(this)) { // Print out additional device information printDeviceInfo(); // Set device configuration to composite configuration index 0 // Obtain first interface if (setConfiguration(0) && findInterface(&mInterface) && mInterface.open(this)) { DebugLog("set configuration and interface opened\n"); mInterface.findPipe(&mInterruptPipe, kUSBInterrupt, kUSBIn); mInterface.findPipe(&mBulkPipe, kUSBBulk, kUSBOut); if (mInterruptPipe.getValidatedPipe() && mBulkPipe.getValidatedPipe()) { DebugLog("got pipes\n"); if (performUpgrade()) if (mDeviceState == kUpdateComplete) AlwaysLog("[%04x:%04x]: Firmware upgrade completed successfully.\n", mVendorId, mProductId); else AlwaysLog("[%04x:%04x]: Firmware upgrade not needed.\n", mVendorId, mProductId); else AlwaysLog("[%04x:%04x]: Firmware upgrade failed.\n", mVendorId, mProductId); OSSafeReleaseNULL(mReadBuffer); // mReadBuffer is allocated by performUpgrade but not released } mInterface.close(this); } // cleanup if (mInterruptPipe.getValidatedPipe()) { mInterruptPipe.abort(); mInterruptPipe.setPipe(NULL); } if (mBulkPipe.getValidatedPipe()) { mBulkPipe.abort(); mBulkPipe.setPipe(NULL); } mInterface.setInterface(NULL); mDevice.close(this); } }
OsmApiDbReader::OsmApiDbReader() : _status(Status::Invalid), _useDataSourceIds(true), _open(false), _osmElemId(-1), _osmElemType(ElementType::Unknown) { setConfiguration(conf()); }
void WebSocketSinkManager::init() { //Protocol list for libwebsockets. protocollist[0] = { "http-only", websocket_callback, 0 }; protocollist[1] = { NULL, NULL, 0 }; setConfiguration(configuration); }
void WiFlyDevice::begin() { /* */ DEBUG_LOG(1, "Entered WiFlyDevice::begin()"); uart.begin(); reboot(); // Reboot to get device into known state requireFlowControl(); setConfiguration(); }
void WiFlyDevice::beginIP(const char *ip) { /* */ DEBUG_LOG(1, "Entered WiFlyDevice::beginIP()"); if (!bDifferentUart) SPIuart.begin(); reboot(); // Reboot to get device into known state //requireFlowControl(); setConfiguration(false, ip); }
ServicesDbWriter::ServicesDbWriter() { _open = false; _remapIds = true; _nodesWritten = 0; _waysWritten = 0; _relationsWritten = 0; setConfiguration(conf()); }
void WiFlyDevice::begin(boolean adhocMode) { /* */ DEBUG_LOG(1, "Entered WiFlyDevice::begin()"); if (!bDifferentUart) SPIuart.begin(); reboot(); // Reboot to get device into known state //requireFlowControl(); setConfiguration(adhocMode); }
void DCDCController::loadConfiguration() { DCDCConfiguration *config = (DCDCConfiguration *)getConfiguration(); if (!config) { config = new DCDCConfiguration(); setConfiguration(config); } Device::loadConfiguration(); // call parent }
void CodaMotorController::loadConfiguration() { CodaMotorControllerConfiguration *config = (CodaMotorControllerConfiguration *)getConfiguration(); if (!config) { config = new CodaMotorControllerConfiguration(); setConfiguration(config); } MotorController::loadConfiguration(); // call parent }
/* * Load configuration data from EEPROM. * * If not available or the checksum is invalid, default values are chosen. */ void BrusaMotorController::loadConfiguration() { BrusaMotorControllerConfiguration *config = (BrusaMotorControllerConfiguration *)getConfiguration(); if(!config) { // as lowest sub-class make sure we have a config object config = new BrusaMotorControllerConfiguration(); setConfiguration(config); } MotorController::loadConfiguration(); // call parent #ifdef USE_HARD_CODED if (false) { #else // if (prefsHandler->checksumValid()) { //checksum is good, read in the values stored in EEPROM if (false) { //TODO: use eeprom, not fixed values #endif Logger::debug(BRUSA_DMC5, (char *)Constants::validChecksum); // prefsHandler->read(EEMC_, &config->minimumLevel1); } else { //checksum invalid. Reinitialize values and store to EEPROM Logger::warn(BRUSA_DMC5, (char *)Constants::invalidChecksum); config->maxMechanicalPowerMotor = 50000; config->maxMechanicalPowerRegen = 0; //TODO: 50000; don't want regen yet ! config->dcVoltLimitMotor = 1000; config->dcVoltLimitRegen = 0;//TODO: 1000; don't want regen yet !; config->dcCurrentLimitMotor = 0; config->dcCurrentLimitRegen = 0; config->enableOscillationLimiter = false; saveConfiguration(); } Logger::debug(BRUSA_DMC5, "Max mech power motor: %d kW, max mech power regen: %d ", config->maxMechanicalPowerMotor, config->maxMechanicalPowerRegen); Logger::debug(BRUSA_DMC5, "DC limit motor: %d Volt, DC limit regen: %d Volt", config->dcVoltLimitMotor, config->dcVoltLimitRegen); Logger::debug(BRUSA_DMC5, "DC limit motor: %d Amps, DC limit regen: %d Amps", config->dcCurrentLimitMotor, config->dcCurrentLimitRegen); } /* * Store the current configuration parameters to EEPROM. */ void BrusaMotorController::saveConfiguration() { BrusaMotorControllerConfiguration *config = (BrusaMotorControllerConfiguration *)getConfiguration(); MotorController::saveConfiguration(); // call parent //TODO: store to eeprom // prefsHandler->write(EEMC_, config->maxMechanicalPowerMotor); // prefsHandler->write(EEMC_, config->maxMechanicalPowerRegen); // prefsHandler->write(EEMC_, config->dcVoltLimitMotor); // prefsHandler->write(EEMC_, config->dcVoltLimitRegen); // prefsHandler->write(EEMC_, config->dcCurrentLimitMotor); // prefsHandler->write(EEMC_, config->dcCurrentLimitRegen); // prefsHandler->write(EEMC_, config->enableOscillationLimiter); prefsHandler->saveChecksum(); }
void MLX90621::measure() { if (checkConfig()) { readEEPROM(); writeTrimmingValue(); setConfiguration(); } readPTAT(); readIR(); calculateTA(); readCPIX(); calculateTO(); }
Motor::Motor(USB::Context& usbContext,size_t index) { /* Get the index-th Kinect motor device from the context: */ USB::DeviceList deviceList(usbContext); USB::Device::operator=(deviceList.getDevice(0x045e,0x02b0,index)); if(!isValid()) Misc::throwStdErr("Kinect::Motor::Motor: Less than %d Kinect motor devices detected",int(index)); /* Open and prepare the device: */ open(); setConfiguration(1); claimInterface(0); }
void WiFlyDevice::begin() { /* */ DEBUG_LOG(1, "Entered WiFlyDevice::begin()"); while (!uart.begin()) { Serial.println("uart init failed, retrying"); } reboot(); // Reboot to get device into known state requireFlowControl(); setConfiguration(); }
ChatWidget * TabsManager::addChat(Chat chat, OpenChatActivation activation) { kdebugf(); auto chatWidget = m_pluginInjectedFactory->makeInjected<ChatWidgetImpl>(chat, nullptr); setConfiguration(chatWidget); if (m_configuration->deprecatedApi()->readBoolEntry("Chat", "SaveOpenedWindows", true)) chatWidget->chat().addProperty("tabs:fix2626", true, CustomProperties::Storable); auto tmpAttached = chat.property("tabs:tmp-attached", false).toBool(); auto tmpDetached = chat.property("tabs:tmp-detached", false).toBool(); auto attached = chat.property("tabs:attached", false).toBool(); auto detached = chat.property("tabs:detached", false).toBool(); if (!tmpAttached && tmpDetached) { DetachedChats.append(chat); return chatWidget; } if (tmpAttached) { insertTab(chatWidget); } else if (!attached && detached) { DetachedChats.append(chat); } else if (attached || ConfigDefaultTabs) insertTab(chatWidget); if (TabDialog->count() == 1) // first tab { switch (activation) { case OpenChatActivation::Minimize: TabDialog->showMinimized(); break; default: TabDialog->show(); break; } } if (activation == OpenChatActivation::Activate) _activateWindow(m_configuration, TabDialog); return chatWidget; }
void CppEditorDocument::setPreprocessorSettings(const CppTools::ProjectPart::Ptr &projectPart, const QByteArray &defines) { const auto parser = processor()->parser(); QTC_ASSERT(parser, return); if (parser->projectPart() != projectPart || parser->configuration().editorDefines != defines) { CppTools::BaseEditorDocumentParser::Configuration config = parser->configuration(); config.manuallySetProjectPart = projectPart; config.editorDefines = defines; parser->setConfiguration(config); emit preprocessorSettingsChanged(!defines.trimmed().isEmpty()); } }
Network::Network(const RuntimeEnvironment *renv,uint64_t nwid,void *uptr) : RR(renv), _uPtr(uptr), _id(nwid), _mac(renv->identity.address(),nwid), _enabled(true), _portInitialized(false), _lastConfigUpdate(0), _destroyed(false), _netconfFailure(NETCONF_FAILURE_NONE), _portError(0) { char confn[128],mcdbn[128]; Utils::snprintf(confn,sizeof(confn),"networks.d/%.16llx.conf",_id); Utils::snprintf(mcdbn,sizeof(mcdbn),"networks.d/%.16llx.mcerts",_id); // These files are no longer used, so clean them. RR->node->dataStoreDelete(mcdbn); if (_id == ZT_TEST_NETWORK_ID) { applyConfiguration(NetworkConfig::createTestNetworkConfig(RR->identity.address())); // Save a one-byte CR to persist membership in the test network RR->node->dataStorePut(confn,"\n",1,false); } else { bool gotConf = false; try { std::string conf(RR->node->dataStoreGet(confn)); if (conf.length()) { setConfiguration(Dictionary(conf),false); _lastConfigUpdate = 0; // we still want to re-request a new config from the network gotConf = true; } } catch ( ... ) {} // ignore invalids, we'll re-request if (!gotConf) { // Save a one-byte CR to persist membership while we request a real netconf RR->node->dataStorePut(confn,"\n",1,false); } } if (!_portInitialized) { ZT_VirtualNetworkConfig ctmp; _externalConfig(&ctmp); _portError = RR->node->configureVirtualNetworkPort(_id,&_uPtr,ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_UP,&ctmp); _portInitialized = true; } }