当前位置: 首页>>代码示例>>C++>>正文


C++ DeviceConfig类代码示例

本文整理汇总了C++中DeviceConfig的典型用法代码示例。如果您正苦于以下问题:C++ DeviceConfig类的具体用法?C++ DeviceConfig怎么用?C++ DeviceConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DeviceConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: assert

void
NmeaReplayGlue::Start()
{
  assert(parser == NULL);
  assert(device == NULL);

  parser = new NMEAParser();
  parser->SetReal(false);

  /* get the device driver name from the profile */
  const DeviceConfig &config =
    CommonInterface::GetSystemSettings().devices[0];

  parser->SetIgnoreChecksum(config.ignore_checksum);

  /* instantiate it */
  const struct DeviceRegister *driver = FindDriverByName(config.driver_name);
  assert(driver != NULL);
  if (driver->CreateOnPort != NULL) {
    DeviceConfig config;
    config.Clear();
    device = driver->CreateOnPort(config, port);
  }

  NmeaReplay::Start();
}
开发者ID:davidswelt,项目名称:XCSoar,代码行数:26,代码来源:NmeaReplayGlue.cpp

示例2: FinishDeviceFields

static bool
FinishDeviceFields(DeviceConfig &config,
                   WndProperty *port_field, WndProperty *speed_field,
                   WndProperty *driver_field)
{
  bool changed = false;

  if (port_field != NULL && FinishPortField(config, *port_field))
    changed = true;

#ifndef ANDROID
  if (config.UsesSpeed() && speed_field != NULL &&
      (int)config.speed_index != speed_field->GetDataField()->GetAsInteger()) {
    config.speed_index = speed_field->GetDataField()->GetAsInteger();
    changed = true;
  }
#endif

  if (config.UsesDriver() && driver_field != NULL &&
      !config.driver_name.equals(driver_field->GetDataField()->GetAsString())) {
    config.driver_name = driver_field->GetDataField()->GetAsString();
    changed = true;
  }

  return changed;
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:26,代码来源:DevicesConfigPanel.cpp

示例3: setAGCMode

void SDRThread::setAGCMode(bool mode) {
    agc_mode.store(mode);
    agc_mode_changed.store(true);
    DeviceConfig *devConfig = deviceConfig.load();
    if (devConfig) {
        devConfig->setAGCMode(mode);
    }
}
开发者ID:digver,项目名称:CubicSDR,代码行数:8,代码来源:SoapySDRThread.cpp

示例4: DeviceConfig

DeviceConfig *AppConfig::getDevice(std::string deviceId) {
    if (deviceConfig.find(deviceId) == deviceConfig.end()) {
        deviceConfig[deviceId] = new DeviceConfig();
    }
    DeviceConfig *conf = deviceConfig[deviceId];
    conf->setDeviceId(deviceId);
    return conf;
}
开发者ID:95rangerxlt,项目名称:CubicSDR,代码行数:8,代码来源:AppConfig.cpp

示例5: getKeyBinding

 /** Get the key bound to a player action (enum GUI::PlayerAction)*/
 std::string getKeyBinding(int Enum_value)
 {
     InputDevice* device = input_manager->getDeviceManager()->getLatestUsedDevice();
     DeviceConfig* config = device->getConfiguration();
     PlayerAction ScriptAction = (PlayerAction)Enum_value;
     irr::core::stringw control = config->getBindingAsString(ScriptAction);
     std::string key = StringUtils::wideToUtf8(control);
     return key;
 }
开发者ID:devnexen,项目名称:stk-code,代码行数:10,代码来源:script_gui.cpp

示例6: setSampleRate

void SDRThread::setSampleRate(int rate) {
    sampleRate.store(rate);
    rate_changed = true;
    DeviceConfig *devConfig = deviceConfig.load();
    if (devConfig) {
        devConfig->setSampleRate(rate);
    }
//    std::cout << "Set sample rate: " << sampleRate.load() << std::endl;
}
开发者ID:digver,项目名称:CubicSDR,代码行数:9,代码来源:SoapySDRThread.cpp

示例7: if

void SDRDevicesDialog::OnUseSelected( wxMouseEvent& event ) {
    if (dev != NULL) {
        int i = 0;
        SoapySDR::ArgInfoList::const_iterator args_i;
        SoapySDR::ArgInfoList args = dev->getSettingsArgInfo();
        
        SoapySDR::Kwargs settingArgs;
        SoapySDR::Kwargs streamArgs;
        
        for (args_i = args.begin(); args_i != args.end(); args_i++) {
            SoapySDR::ArgInfo arg = (*args_i);
            wxPGProperty *prop = props[i];
            
            if (arg.type == SoapySDR::ArgInfo::STRING && arg.options.size()) {
                settingArgs[arg.key] = arg.options[prop->GetChoiceSelection()];
            } else if (arg.type == SoapySDR::ArgInfo::BOOL) {
                settingArgs[arg.key] = (prop->GetValueAsString()=="True")?"true":"false";
            } else {
                settingArgs[arg.key] = prop->GetValueAsString();
            }
            
            i++;
        }
        
        if (dev->getRxChannel()) {
            args = dev->getRxChannel()->getStreamArgsInfo();
            
            if (args.size()) {
                for (args_i = args.begin(); args_i != args.end(); args_i++) {
                    SoapySDR::ArgInfo arg = (*args_i);
                    wxPGProperty *prop = props[i];
            
                    if (arg.type == SoapySDR::ArgInfo::STRING && arg.options.size()) {
                        streamArgs[arg.key] = arg.options[prop->GetChoiceSelection()];
                    } else if (arg.type == SoapySDR::ArgInfo::BOOL) {
                        streamArgs[arg.key] = (prop->GetValueAsString()=="True")?"true":"false";
                    } else {
                        streamArgs[arg.key] = prop->GetValueAsString();
                    }
                    
                    i++;
                }
            }
        }
        
        AppConfig *cfg = wxGetApp().getConfig();
        DeviceConfig *devConfig = cfg->getDevice(dev->getDeviceId());
        devConfig->setSettings(settingArgs);
        devConfig->setStreamOpts(streamArgs);
        wxGetApp().setDeviceArgs(settingArgs);
        wxGetApp().setStreamArgs(streamArgs);
        wxGetApp().setDevice(dev);
        Close();
    }
}
开发者ID:viraptor,项目名称:CubicSDR,代码行数:55,代码来源:SDRDevices.cpp

示例8: setDevice

void CubicSDR::setDevice(SDRDeviceInfo *dev) {
    if (!sdrThread->isTerminated()) {
        sdrThread->terminate();
        if (t_SDR) {
            t_SDR->join();
            delete t_SDR;
        }
    }
    
    for (SoapySDR::Kwargs::const_iterator i = settingArgs.begin(); i != settingArgs.end(); i++) {
        sdrThread->writeSetting(i->first, i->second);
    }
    sdrThread->setStreamArgs(streamArgs);
    sdrThread->setDevice(dev);
    
    DeviceConfig *devConfig = config.getDevice(dev->getDeviceId());
    
    SoapySDR::Device *soapyDev = dev->getSoapyDevice();
    
    if (soapyDev) {
        if (long devSampleRate = devConfig->getSampleRate()) {
            sampleRate = dev->getSampleRateNear(SOAPY_SDR_RX, 0, devSampleRate);
            sampleRateInitialized.store(true);
        }
        
        if (!sampleRateInitialized.load()) {
            sampleRate = dev->getSampleRateNear(SOAPY_SDR_RX, 0, DEFAULT_SAMPLE_RATE);
            sampleRateInitialized.store(true);
        } else {
            sampleRate = dev->getSampleRateNear(SOAPY_SDR_RX, 0, sampleRate);
        }

        if (frequency < sampleRate/2) {
            frequency = sampleRate/2;
        }

        setFrequency(frequency);
        setSampleRate(sampleRate);

        setPPM(devConfig->getPPM());
        setOffset(devConfig->getOffset());
        

        if (devConfig->getAGCMode()) {
            setAGCMode(true);
        } else {
            setAGCMode(false);
        }

        t_SDR = new std::thread(&SDRThread::threadMain, sdrThread);
}
    
    stoppedDev = nullptr;
}
开发者ID:hightemp,项目名称:CubicSDR,代码行数:54,代码来源:CubicSDR.cpp

示例9: lock

void SDRThread::setGain(std::string name, float value) {
    std::lock_guard < std::mutex > lock(gain_busy);
    gainValues[name] = value;
    gainChanged[name] = true;
    gain_value_changed.store(true);
    
    DeviceConfig *devConfig = deviceConfig.load();
    if (devConfig) {
        devConfig->setGain(name, value);
    }
}
开发者ID:digver,项目名称:CubicSDR,代码行数:11,代码来源:SoapySDRThread.cpp

示例10: wxGetApp

void AppFrame::initDeviceParams(std::string deviceId) {
    DeviceConfig *devConfig = wxGetApp().getConfig()->getDevice(deviceId);
    
    int dsMode = devConfig->getDirectSampling();
    
    if (dsMode > 0 && dsMode <= 2) {
        directSamplingMenuItems[devConfig->getDirectSampling()]->Check();
    }
    
    if (devConfig->getIQSwap()) {
        iqSwapMenuItem->Check();
    }
}
开发者ID:95rangerxlt,项目名称:CubicSDR,代码行数:13,代码来源:AppFrame.cpp

示例11: senderThreadActive

Matrix4CalibrationDev::Matrix4CalibrationDev(const DeviceConfig & deviceConfig) :
    senderThreadActive(false),
    receiverThreadActive(false),
    vec1Size(0),
    vec2Size(0),
    trackVectors(false),
    premultiply(false),
    useAverage(false) {

    this->deviceDescriptor.setEntityID(deviceConfig.getEntityID());
    this->entityID = this->deviceDescriptor.getEntityID();

    map<string, Port> portMap;
    map<string, int> namePortNrMap;
    
    addPort(Port("Vector1",               "Vector4",        Port::Sink, ""),    PortNR_Vector1,                 portMap, namePortNrMap);
    addPort(Port("Vector2",               "Vector4",        Port::Sink, ""),    PortNR_Vector2,                 portMap, namePortNrMap);
    addPort(Port("CalibratedMatrix",      "Matrix4",        Port::Source, ""),  PortNR_CalibratedMatrix,        portMap, namePortNrMap);
    addPort(Port("ApplyVectors",          "DigitalChannel", Port::Sink, ""),    PortNR_ApplyVectors,            portMap, namePortNrMap);
    addPort(Port("ClearVectors",          "DigitalChannel", Port::Sink, ""),    PortNR_ClearVectors,            portMap, namePortNrMap);
    addPort(Port("LoadCalibratedMatrix",  "DigitalChannel", Port::Sink, ""),    PortNR_LoadCalibratedMatrix,    portMap, namePortNrMap);
    addPort(Port("SaveCalibratedMatrix",  "DigitalChannel", Port::Sink, ""),    PortNR_SaveCalibratedMatrix,    portMap, namePortNrMap);
    addPort(Port("SendCalibratedMatrix",  "DigitalChannel", Port::Sink, ""),    PortNR_SendCalibratedMatrix,    portMap, namePortNrMap);
    addPort(Port("CalcCalibratedMatrix",  "DigitalChannel", Port::Sink, ""),    PortNR_CalcCalibratedMatrix,    portMap, namePortNrMap);

    DeviceType deviceType;
    deviceType.setPortMap(portMap);
    deviceType.setDeviceTypeName("Matrix4CalibrationDev");
    deviceType.setDescription("");

    this->deviceDescriptor.setDeviceType(deviceType);
    this->deviceDescriptor.setNameChannelNrMap(namePortNrMap);
    
    try {
        this->initialSend = deviceConfig.getParameterGroup().getInt("CalibratedMatrix|InitialSend") != 0;
        TFDEBUG("initialSend = " << this->initialSend);
        
        this->calibratedMatrixPath = deviceConfig.getParameterGroup().getString("CalibratedMatrix|Path");
        TFDEBUG("calibratedMatrixPath = " << this->calibratedMatrixPath);
        
        this->premultiply = deviceConfig.getParameterGroup().getInt("CalibratedMatrix|Pre-multiply") != 0;
        TFINFO("pre-multiply = " << this->premultiply);
        
        this->useAverage = deviceConfig.getParameterGroup().getInt("ApplyVectors|useAverage") != 0;
        TFINFO("useAverage = " << this->useAverage);
    }
    catch(Exception & e) {
        TFERROR(e.getFormattedString());
    }
}
开发者ID:Lammmark,项目名称:tuiframework,代码行数:50,代码来源:Matrix4CalibrationDev.cpp

示例12: command

void CubicSDR::setDevice(int deviceId) {
    sdrThread->setDeviceId(deviceId);
    SDRThreadCommand command(SDRThreadCommand::SDR_THREAD_CMD_SET_DEVICE);
    command.llong_value = deviceId;
    pipeSDRCommand->push(command);

    SDRDeviceInfo *dev = (*getDevices())[deviceId];
    DeviceConfig *devConfig = config.getDevice(dev->getDeviceId());

    setPPM(devConfig->getPPM());
    setDirectSampling(devConfig->getDirectSampling());
    setSwapIQ(devConfig->getIQSwap());
    setOffset(devConfig->getOffset());
}
开发者ID:hotelzululima,项目名称:CubicSDR,代码行数:14,代码来源:CubicSDR.cpp

示例13: devStartup

void
devStartup()
{
  LogStartUp(_T("Register serial devices"));

  const SystemSettings &settings = CommonInterface::GetSystemSettings();

  bool none_available = true;
  for (unsigned i = 0; i < NUMDEV; ++i) {
    DeviceDescriptor &device = *device_list[i];
    const DeviceConfig &config = settings.devices[i];
    if (!config.IsAvailable()) {
      device.ClearConfig();
      continue;
    }

    none_available = false;

    bool overlap = false;
    for (unsigned j = 0; j < i; ++j)
      if (DeviceConfigOverlaps(config, device_list[j]->GetConfig()))
        overlap = true;

    if (overlap) {
      device.ClearConfig();
      continue;
    }

    device.SetConfig(config);
    devInitOne(*device_list[i]);
  }

  if (none_available) {
#ifdef ANDROID
    /* fall back to built-in GPS when no configured device is
       available on this platform */
    LogStartUp(_T("Falling back to built-in GPS"));

    DeviceConfig config;
    config.Clear();
    config.port_type = DeviceConfig::PortType::INTERNAL;

    DeviceDescriptor &device = *device_list[0];
    device.SetConfig(config);
    devInitOne(device);
#endif
  }
}
开发者ID:damianob,项目名称:xcsoar_mess,代码行数:48,代码来源:device.cpp

示例14: setDevice

void CubicSDR::setDevice(SDRDeviceInfo *dev) {
    if (!sdrThread->isTerminated()) {
        sdrThread->terminate();
        if (t_SDR) {
            t_SDR->join();
            delete t_SDR;
        }
    }
    
    for (SoapySDR::Kwargs::const_iterator i = settingArgs.begin(); i != settingArgs.end(); i++) {
        sdrThread->writeSetting(i->first, i->second);
    }
    sdrThread->setStreamArgs(streamArgs);
    sdrThread->setDevice(dev);
    
    DeviceConfig *devConfig = config.getDevice(dev->getDeviceId());
    
    SoapySDR::Device *soapyDev = dev->getSoapyDevice();
    
    if (soapyDev) {
        //long long freqHigh, freqLow;
        
        //SoapySDR::RangeList freqRange = soapyDev->getFrequencyRange(SOAPY_SDR_RX, 0);
        
        //freqLow = freqRange[0].minimum();
        //freqHigh = freqRange[freqRange.size()-1].maximum();

        // Try for a reasonable default sample rate.
        if (!sampleRateInitialized.load()) {
            sampleRate = dev->getSampleRateNear(SOAPY_SDR_RX, 0, DEFAULT_SAMPLE_RATE);
            sampleRateInitialized.store(true);
        } else {
            sampleRate = dev->getSampleRateNear(SOAPY_SDR_RX, 0, sampleRate);
        }

        if (frequency < sampleRate/2) {
            frequency = sampleRate/2;
        }

        setFrequency(frequency);
        setSampleRate(sampleRate);

        setPPM(devConfig->getPPM());
        setOffset(devConfig->getOffset());

        t_SDR = new std::thread(&SDRThread::threadMain, sdrThread);
    }
}
开发者ID:george-viaud,项目名称:CubicSDR,代码行数:48,代码来源:CubicSDR.cpp

示例15: main

int main(int argc, char **argv)
{
  NarrowString<1024> usage;
  usage = "DRIVER\n\n"
          "Where DRIVER is one of:";
  {
    const DeviceRegister *driver;
    for (unsigned i = 0; (driver = GetDriverByIndex(i)) != nullptr; ++i) {
      WideToUTF8Converter driver_name(driver->name);
      usage.AppendFormat("\n\t%s", (const char *)driver_name);
    }
  }

  Args args(argc, argv, usage);
  tstring driver_name = args.ExpectNextT();
  args.ExpectEnd();

  driver = FindDriverByName(driver_name.c_str());
  if (driver == nullptr) {
    _ftprintf(stderr, _T("No such driver: %s\n"), driver_name.c_str());
    return 1;
  }

  DeviceConfig config;
  config.Clear();

  NullPort port;
  Device *device = driver->CreateOnPort != nullptr
    ? driver->CreateOnPort(config, port)
    : nullptr;

  NMEAParser parser;

  NMEAInfo data;
  data.Reset();

  char buffer[1024];
  while (fgets(buffer, sizeof(buffer), stdin) != nullptr) {
    StripRight(buffer);

    if (device == nullptr || !device->ParseNMEA(buffer, data))
      parser.ParseLine(buffer, data);
  }

  Dump(data);

  return EXIT_SUCCESS;
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:48,代码来源:RunDeviceDriver.cpp


注:本文中的DeviceConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。