// Show device options dialog. void ChannelForm::setupDevice ( Device *pDevice, Device::DeviceType deviceTypeMode, const QString& sDriverName ) { MainForm *pMainForm = MainForm::getInstance(); if (pMainForm == NULL) return; if (pMainForm->client() == NULL) return; // Create the device form if not already... if (m_pDeviceForm == NULL) { m_pDeviceForm = new DeviceForm(this, Qt::Dialog); m_pDeviceForm->setAttribute(Qt::WA_ShowModal); QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()), this, SLOT(updateDevices())); } // Refresh the device form with selected data. if (m_pDeviceForm) { m_pDeviceForm->setDeviceTypeMode(deviceTypeMode); m_pDeviceForm->refreshDevices(); m_pDeviceForm->setDevice(pDevice); m_pDeviceForm->setDriverName(sDriverName); m_pDeviceForm->show(); } }
AudioPortAudio::setupWidget::~setupWidget() { disconnect( &m_setupUtil.m_backendModel, SIGNAL( dataChanged() ), &m_setupUtil, SLOT( updateDevices() ) ); disconnect( &m_setupUtil.m_deviceModel, SIGNAL( dataChanged() ), &m_setupUtil, SLOT( updateChannels() ) ); }
void MIDIProtocolSettingsWidget::buildGUI() { m_name = new QLineEdit; m_inButton = new QCheckBox(tr("Input"), this); m_inButton->setAutoExclusive(true); m_outButton = new QCheckBox(tr("Output"), this); m_outButton->setAutoExclusive(true); m_deviceCBox = new QComboBox(this); auto gb = new QWidget; gb->setContentsMargins(0, 0, 0, 0); auto gb_lay = new QHBoxLayout; gb_lay->setContentsMargins(0, 0, 0, 0); gb_lay->addWidget(m_inButton); gb_lay->addWidget(m_outButton); gb->setLayout(gb_lay); auto lay = new QFormLayout; lay->addRow(tr("Name"), m_name); lay->addRow(tr("Type"), gb); lay->addRow(tr("Device"), m_deviceCBox); setLayout(lay); connect(m_inButton, &QAbstractButton::toggled, this, [this] (bool b) { if(b) { updateDevices(OSSIA::MidiInfo::Type::RemoteInput); } }); connect(m_outButton, &QAbstractButton::toggled, this, [this] (bool b) { if(b) { updateDevices(OSSIA::MidiInfo::Type::RemoteOutput); } }); m_inButton->setChecked(true); //TODO: QSettings updateInputDevices(); }
QList<QByteArray> QGstreamerServicePlugin::devices(const QByteArray &service) const { if (service == Q_MEDIASERVICE_CAMERA) { if (m_cameraDevices.isEmpty()) updateDevices(); return m_cameraDevices; } return QList<QByteArray>(); }
QList<QByteArray> S60CameraServicePlugin::devices(const QByteArray &service) const { #ifdef QMEDIA_SYMBIAN_CAMERA if (service == Q_MEDIASERVICE_CAMERA) { if (m_cameraDevices.isEmpty()) updateDevices(); return m_cameraDevices; } #endif return QList<QByteArray>(); }
QString QGstreamerServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device) { if (service == Q_MEDIASERVICE_CAMERA) { if (m_cameraDevices.isEmpty()) updateDevices(); for (int i=0; i<m_cameraDevices.count(); i++) if (m_cameraDevices[i] == device) return m_cameraDescriptions[i]; } return QString(); }
BackendManager::BackendManager() { //Order matters if(VgaSwitcherooBackend::available()){ backendName="VgaSwitcheroo"; backend=new VgaSwitcherooBackend(); }else{ backendName="NullBackend"; backend=new NullBackend(); } connect(backend,SIGNAL(changed(QList<Device>)),SLOT(updateDevices())); connect(this,SIGNAL(needsUpdateDevicesInternal()),SLOT(updateDevicesInternal())); }
QString DSServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device) { #ifdef QMEDIA_DIRECTSHOW_CAMERA if (service == Q_MEDIASERVICE_CAMERA) { if (m_cameraDevices.isEmpty()) updateDevices(); for (int i=0; i<m_cameraDevices.count(); i++) if (m_cameraDevices[i] == device) return m_cameraDescriptions[i]; } #endif return QString(); }
Controller::Controller() : _deviceNeedResolve(0), _lastTimeFocused(0), _service(&_udpDiscovery, this), _udpDiscoveryTimer(this) { _service.moveToThread(&_serviceThread); _serviceThread.start(); _view = new View(&_model); _bonjourBrowser = new BonjourServiceBrowser(this); connect(&_udpDiscovery, SIGNAL(devicesFound(const QList<Device *> &)), this, SLOT(updateDevices(const QList<Device *> &))); connect(&_udpDiscovery, SIGNAL(pongReceived(const QString&)), this, SLOT(onPong(const QString &))); connect(_bonjourBrowser, SIGNAL(currentBonjourRecordsChanged(const QList<BonjourRecord> &)), this, SLOT(updateRecords(const QList<BonjourRecord> &))); connect(_bonjourBrowser, SIGNAL(error(DNSServiceErrorType)), this, SLOT(error(DNSServiceErrorType))); connect(_view, SIGNAL(sendFile(const QString&, const QList<QUrl>&, DataType)), this, SLOT(onSendFile(const QString&, const QList<QUrl>&, DataType))); connect(_view, SIGNAL(sendText(const QString&, const QString&, DataType)), this, SLOT(onSendText(const QString&, const QString&, DataType))); connect(_view, SIGNAL(cancelTransfert(const QString&)), this, SLOT(onCancelTransfert(const QString&))); connect(_view, SIGNAL(focused()), this, SLOT(onWindowFocused())); connect(_view, SIGNAL(forceRefresh()), this, SLOT(onForceRefresh())); connect(_view, SIGNAL(registerService()), &_service, SLOT(serviceRegister())); connect(_view, SIGNAL(unregisterService()), &_service, SLOT(serviceUnregister())); connect(_view, SIGNAL(deleteFromHistory(int)), &_service, SLOT(onDeleteFromHistory(int))); connect(_view, SIGNAL(clearHistoryTriggered()), &_service, SLOT(onClearHistory())); connect(_view, SIGNAL(serviceNameChanged()), &_service, SLOT(onTimerOut())); connect(_view, SIGNAL(cancelIncomingTransfert()), &_service, SLOT(deleteFileReset())); connect(&_service, SIGNAL(historyChanged(const QList<HistoryElement>&)), _view, SLOT(onHistoryChanged(const QList<HistoryElement>&))); connect(&_service, SIGNAL(historyElementProgressUpdated(unsigned)), _view, SLOT(historyElementProgressUpdated(unsigned))); connect(&_service, SIGNAL(serviceError(ServiceErrorState,bool)), _view, SLOT(onServiceError(ServiceErrorState,bool))); connect(&_service, SIGNAL(receivingFile(const QString&,int)), _view, SLOT(onReceivingFile(const QString&,int))); connect(&_service, SIGNAL(receivingFolder(const QString&,int)), _view, SLOT(onReceivingFolder(const QString&,int))); connect(&_service, SIGNAL(receivingText(const QString&)), _view, SLOT(onReceivingText(const QString&))); connect(&_service, SIGNAL(receivingUrl(const QString&)), _view, SLOT(onReceivingUrl(const QString&))); connect(&_model, SIGNAL(newDeviceCreated(Device*)), this, SLOT(onNewDeviceCreated(Device*))); connect(&_model, SIGNAL(deviceRemoved()), _view, SLOT(updateDevices())); connect(&_updater, SIGNAL(updateNeeded(const QString&,const QString&)), _view, SLOT(onUpdateNeeded(const QString&,const QString&))); checkForBonjourState(); _view->updateDevices(); _view->onHistoryChanged(_service.getHistory()); _bonjourBrowser->browseForServiceType(QLatin1String("_fdnd._tcp.")); connect(&_udpDiscoveryTimer, SIGNAL(timeout()), &_udpDiscovery, SLOT(startDiscovery())); _udpDiscoveryTimer.start(UDP_DISCOVERY_INTERVAL); _udpDiscovery.startDiscovery(); createSendTo(); }
void QPulseAudioEngine::prepare() { bool keepGoing = true; bool ok = true; m_mainLoop = pa_threaded_mainloop_new(); if (m_mainLoop == 0) { qWarning("PulseAudioService: unable to create pulseaudio mainloop"); return; } if (pa_threaded_mainloop_start(m_mainLoop) != 0) { qWarning("PulseAudioService: unable to start pulseaudio mainloop"); pa_threaded_mainloop_free(m_mainLoop); m_mainLoop = 0; return; } m_mainLoopApi = pa_threaded_mainloop_get_api(m_mainLoop); lock(); m_context = pa_context_new(m_mainLoopApi, QString(QLatin1String("QtPulseAudio:%1")).arg(::getpid()).toLatin1().constData()); if (m_context == 0) { qWarning("PulseAudioService: Unable to create new pulseaudio context"); pa_threaded_mainloop_unlock(m_mainLoop); pa_threaded_mainloop_free(m_mainLoop); m_mainLoop = 0; onContextFailed(); return; } pa_context_set_state_callback(m_context, contextStateCallbackInit, this); if (pa_context_connect(m_context, 0, (pa_context_flags_t)0, 0) < 0) { qWarning("PulseAudioService: pa_context_connect() failed"); pa_context_unref(m_context); pa_threaded_mainloop_unlock(m_mainLoop); pa_threaded_mainloop_free(m_mainLoop); m_mainLoop = 0; m_context = 0; return; } pa_threaded_mainloop_wait(m_mainLoop); while (keepGoing) { switch (pa_context_get_state(m_context)) { case PA_CONTEXT_CONNECTING: case PA_CONTEXT_AUTHORIZING: case PA_CONTEXT_SETTING_NAME: break; case PA_CONTEXT_READY: #ifdef DEBUG_PULSE qDebug("Connection established."); #endif keepGoing = false; break; case PA_CONTEXT_TERMINATED: qCritical("PulseAudioService: Context terminated."); keepGoing = false; ok = false; break; case PA_CONTEXT_FAILED: default: qCritical() << QString("PulseAudioService: Connection failure: %1").arg(pa_strerror(pa_context_errno(m_context))); keepGoing = false; ok = false; } if (keepGoing) pa_threaded_mainloop_wait(m_mainLoop); } if (ok) { pa_context_set_state_callback(m_context, contextStateCallback, this); } else { pa_context_unref(m_context); m_context = 0; } unlock(); if (ok) { updateDevices(); m_prepared = true; } else { pa_threaded_mainloop_free(m_mainLoop); m_mainLoop = 0; onContextFailed(); } }
void MIDIProtocolSettingsWidget::updateOutputDevices() { updateDevices(OSSIA::MidiInfo::Type::RemoteOutput); }
AudioPortAudio::setupWidget::setupWidget( QWidget * _parent ) : AudioDeviceSetupWidget( AudioPortAudio::name(), _parent ) { m_backend = new ComboBox( this, "BACKEND" ); m_backend->setGeometry( 64, 15, 260, 20 ); QLabel * backend_lbl = new QLabel( tr( "BACKEND" ), this ); backend_lbl->setFont( pointSize<7>( backend_lbl->font() ) ); backend_lbl->move( 8, 18 ); m_device = new ComboBox( this, "DEVICE" ); m_device->setGeometry( 64, 35, 260, 20 ); QLabel * dev_lbl = new QLabel( tr( "DEVICE" ), this ); dev_lbl->setFont( pointSize<7>( dev_lbl->font() ) ); dev_lbl->move( 8, 38 ); /* LcdSpinBoxModel * m = new LcdSpinBoxModel( ); m->setRange( DEFAULT_CHANNELS, SURROUND_CHANNELS ); m->setStep( 2 ); m->setValue( ConfigManager::inst()->value( "audioportaudio", "channels" ).toInt() ); m_channels = new LcdSpinBox( 1, this ); m_channels->setModel( m ); m_channels->setLabel( tr( "CHANNELS" ) ); m_channels->move( 308, 20 );*/ // Setup models PaError err = Pa_Initialize(); if( err != paNoError ) { printf( "Couldn't initialize PortAudio: %s\n", Pa_GetErrorText( err ) ); return; } // todo: setup backend model const PaHostApiInfo * hi; for( int i = 0; i < Pa_GetHostApiCount(); ++i ) { hi = Pa_GetHostApiInfo( i ); m_setupUtil.m_backendModel.addItem( hi->name ); } Pa_Terminate(); const QString& backend = ConfigManager::inst()->value( "audioportaudio", "backend" ); const QString& device = ConfigManager::inst()->value( "audioportaudio", "device" ); int i = qMax( 0, m_setupUtil.m_backendModel.findText( backend ) ); m_setupUtil.m_backendModel.setValue( i ); m_setupUtil.updateDevices(); i = qMax( 0, m_setupUtil.m_deviceModel.findText( device ) ); m_setupUtil.m_deviceModel.setValue( i ); connect( &m_setupUtil.m_backendModel, SIGNAL( dataChanged() ), &m_setupUtil, SLOT( updateDevices() ) ); connect( &m_setupUtil.m_deviceModel, SIGNAL( dataChanged() ), &m_setupUtil, SLOT( updateChannels() ) ); m_backend->setModel( &m_setupUtil.m_backendModel ); m_device->setModel( &m_setupUtil.m_deviceModel ); }
//----------------------------------------------------------------------------- void CCBRobot::run() { if ( not mFgInitialized ) { PRT_WARN0( "Robot is not initialized, call init() first" ); return; } while ( mFgRunning ) { // get data from ICreate //printf("mLastLoopDuration %f \n",mLastLoopDuration); if ( mCBDriver->readSensorData( mLastLoopDuration ) == 1 ) { // update all devices if ( mCBDrivetrain ) mCBDrivetrain->updateData( mUpdateInterval ); if ( mCBPowerPack ) mCBPowerPack->updateData( mLastLoopDuration ); if ( mCBLaser ) mCBLaser->updateData( mLastLoopDuration ); if ( mCBLights ) mCBLights->updateData( mLastLoopDuration ); if ( mCBSound ) mCBSound->updateData( mLastLoopDuration ); if ( mCBIrSensor ) mCBIrSensor->updateData( mLastLoopDuration ); if ( mCBTextDisplay ) mCBTextDisplay->updateData( mLastLoopDuration ); if ( mCBBumper ) mCBBumper->updateData( mLastLoopDuration ); if ( mCBWallSensor ) mCBWallSensor->updateData( mLastLoopDuration ); if ( mCBWheelDropSensor ) mCBWheelDropSensor->updateData( mLastLoopDuration ); if ( mCBCliffSensor ) mCBCliffSensor->updateData( mLastLoopDuration ); if ( mCBOverCurrentSensor ) mCBOverCurrentSensor->updateData( mLastLoopDuration ); if ( mCBFrontFiducial ) mCBFrontFiducial->updateData( mLastLoopDuration ); if ( mCBTopFiducial ) mCBTopFiducial->updateData( mLastLoopDuration ); if ( mCBPhotoSensor ) mCBPhotoSensor->updateData( mLastLoopDuration ); if ( mCBCreateButton ) mCBCreateButton->updateData( mLastLoopDuration ); if ( mCBVirtualWall ) mCBVirtualWall->updateData( mLastLoopDuration ); updateDevices(); // Low side drivers updateData() is empty, no need to call it here //if ( mCBLowSideDriver ) // mCBLowSideDriver->updateData(); } // update all registered controllers updateControllers(); //****************************************************** // last step - keep everything in sync synchronize( mUpdateInterval ); } // while }
int main(int argc, char *argv[]){ /* Local vars */ char filename[MAX_FILENAME_LENGTH]; FILE* devFile = NULL; struct SWDeviceEntry newEntry; int devCnt = 0; struct SWDeviceEntry devices[MASTER_MAXDEVICES]; struct SWDeviceEntry* findDev = NULL; /* Handel Input */ (void) argc; (void) argv; /* Get Device Filename */ if(buildDevFileName(filename, MAX_FILENAME_LENGTH) <= 0){ fprintf(stderr, "masterTest: Could not create devFile name.\n"); exit(EXIT_FAILURE); } /* Open Device File */ devFile = openDevFile(filename); if(devFile == NULL){ fprintf(stderr, "masterTest: Could not open devFile.\n"); exit(EXIT_FAILURE); } /* Write Test record */ newEntry.devInfo.swAddr = 0x0003u; newEntry.ipAddr = 0x33333333u; newEntry.devInfo.devTypes = SW_TYPE_UNIVERSAL | SW_TYPE_OUTLET; newEntry.devInfo.numChan = 0x03u; newEntry.devInfo.groupID = 0x01u; newEntry.devInfo.version = SW_VERSION; newEntry.devInfo.uid = 0x3333333333333333ull; newEntry.lineNum = -1; if(fseek(devFile, 0, SEEK_END) != 0){ fprintf(stderr, "masterTest: Could not seek to end of devFile.\n"); exit(EXIT_FAILURE); } if(writeDevice(&newEntry, devFile) < 0){ fprintf(stderr, "masterTest: Error writing new device to devFile.\n"); exit(EXIT_FAILURE); } /* Get Device Array */ devCnt = getDevices(devices, MASTER_MAXDEVICES, devFile); if(devCnt < 0){ fprintf(stderr, "masterTest: " "Error getting device list: getDevices returned %d\n", devCnt); exit(EXIT_FAILURE); } /* Sort Device Array */ if(sortDevices(devices, devCnt) < 0){ fprintf(stderr, "masterTest: Error sorting device list.\n"); exit(EXIT_FAILURE); } /* Find new device in array */ findDev = findDevice(newEntry.devInfo.swAddr, devices, devCnt); if(findDev == NULL){ fprintf(stderr, "masterTest: Could not find new device.\n"); exit(EXIT_FAILURE); } /* Remove new device from devFile */ findDev->lineNum = -1; devFile = updateDevices(devices, &devCnt, devFile); if(devFile == NULL){ fprintf(stderr, "masterTest: Could not update devFile.\n"); exit(EXIT_FAILURE); } /* Close Device File */ if(closeDevFile(devFile) != 0){ fprintf(stderr, "masterTest: Could not close devFile.\n"); exit(EXIT_FAILURE); } devFile = NULL; return 0; }
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SimpleDeviceManagerInputLevelMeter) }; //============================================================================== class AudioDeviceSelectorComponent::MidiInputSelectorComponentListBox : public ListBox, private ListBoxModel { public: MidiInputSelectorComponentListBox (AudioDeviceManager& dm, const String& noItems) : ListBox ({}, nullptr), deviceManager (dm), noItemsMessage (noItems) { updateDevices(); setModel (this); setOutlineThickness (1); } void updateDevices() { items = MidiInput::getDevices(); } int getNumRows() override { return items.size(); } void paintListBoxItem (int row, Graphics& g, int width, int height, bool rowIsSelected) override