Example #1
0
IRController::IRController(QObject* parent) : QObject(parent), m_device(0), m_st(IRController::Off)
{
    // Load protocols
    QString tdir = Qtopia::qtopiaDir()+"/etc/beam/targets";
    QDir dir(tdir,"*.conf");
    protocount=0;
    QSettings cfgout("Trolltech","Beam");
    cfgout.beginGroup("Send");
    QString curdev=cfgout.value("DeviceConfig").toString();
    curproto = 0;
    for (int i=0; i<(int)dir.count(); i++) {
        QString t=tdir+"/"+dir[i];
        QTranslatableSettings cfg(t, QSettings::IniFormat);
        if ( cfg.status()==QSettings::NoError ) {
            cfg.beginGroup("Device");
            names.append(cfg.value("Name").toString());
            icons.append(cfg.value("Icon").toString());
            targets.append(t);
            if ( curdev.isEmpty() )
                curdev=t;
            if ( curdev == t )
                curproto = protocount;
            protocount++;
        }
    }

    QStringList devices = QIrLocalDevice::devices();

    if (devices.size() > 0) {
        m_device = new QCommDeviceController(devices[0].toLatin1());
        connect(m_device, SIGNAL(powerStateChanged(QCommDeviceController::PowerState)),
                SLOT(powerStateChanged(QCommDeviceController::PowerState)));
        powerStateChanged(m_device->powerState());
    }
}
Example #2
0
void CLSPGT8000HVChannel::onVoltageChanged(double voltage){
	emit voltageChanged(voltage);
	if(isOn() && demand_->withinTolerance(voltage))
		emit fullyPowered();
	if(isConnected() && poweringDown_ && (voltage_->value()) < 1){
		poweringDown_ = false;
		powerState_ = AMHighVoltageChannel::isPowerOff;
		emit powerStateChanged(powerState_);
	}
}
Example #3
0
AMHighVoltageChannel::AMHighVoltageChannel(const QString &name, QObject *parent) :
		QObject(parent)
{
	name_ = name;
	powerState_ = AMHighVoltageChannel::isPowerInvalid;
	polarity_ = AMHighVoltageChannel::none;
	noCurrent_ = true;
	noPolarity_ = true;
	connect(this, SIGNAL(powerStateChanged(AMHighVoltageChannel::highVoltageChannelPowerState)), this, SLOT(onPowerStateChanged(AMHighVoltageChannel::highVoltageChannelPowerState)));
}
Example #4
0
void BTSettingsMainWindow::init()
{
    MyDevicesDisplay *pairedDevices = new MyDevicesDisplay(m_localDevice);

    m_tabs->setUpdatesEnabled(false);
    QString title = m_tabs->tabText(1);
    delete m_tabs->widget(1);
    m_tabs->insertTab(1, pairedDevices, title);
    m_tabs->setUpdatesEnabled(true);

    connect(m_controller, SIGNAL(powerStateChanged(QCommDeviceController::PowerState)),
            SLOT(setTabsEnabled(QCommDeviceController::PowerState)));
    setTabsEnabled(m_controller->powerState());

    QTimer::singleShot(200, pairedDevices, SLOT(populateDeviceList()));
}
Example #5
0
void QuickOutput::setPowerState(PowerState state)
{
    Q_D(QuickOutput);

    // Power state is supported only with native screens and our QPA
    Platform::EglFSScreen *screen = Q_NULLPTR;
    if (d->nativeScreen && d->nativeScreen->screen())
        screen = static_cast<Platform::EglFSScreen *>(
                    d->nativeScreen->screen()->handle());
    if (!screen)
        return;

    Platform::EglFSScreen::PowerState pstate =
            static_cast<Platform::EglFSScreen::PowerState>(state);
    if (screen->powerState() != pstate) {
        screen->setPowerState(pstate);
        Q_EMIT powerStateChanged();
    }
}
Example #6
0
QCommDeviceController_Private::QCommDeviceController_Private(const QByteArray &devId,
        QCommDeviceController *parent) : QObject(parent), m_sock(0)
{
    m_parent = parent;
    m_devId = devId;

    QByteArray p("/Hardware/Devices/");
    p.append(m_devId);

    // Find out the path to connect the UNIX socket to
    QValueSpaceItem *vPath = new QValueSpaceItem(p);
    QVariant path = vPath->value("Path");
    m_path = path.toByteArray();
    delete vPath;

    // ValueSpaceItem for up/down information
    QByteArray ud(p);
    ud.append("/Status");
    m_upDown = new QValueSpaceItem(ud);
    connect(m_upDown, SIGNAL(contentsChanged()),
            this, SLOT(statusChanged()));

    // ValueSpaceItem for Power State information
    QByteArray powerState(p);
    powerState.append("/PowerState");
    m_state = new QValueSpaceItem(powerState);
    connect(m_state, SIGNAL(contentsChanged()),
            this, SLOT(powerStateChanged()));

    // ValueSpaceItem for whether there are any active sessions
    QByteArray sessionsActive(p);
    sessionsActive.append("/ActiveSessions");
    m_sessionsActive = new QValueSpaceItem(sessionsActive);

    m_sock = new QUnixSocket();

    if (!m_sock->connect(m_path)) {
        delete m_sock;
        m_sock = 0;
        return;
    }
}
Example #7
0
RPowerInfo::RPowerInfo(QObject* parent)
    : QObject(parent), _screenSaver(NULL)
{
    _devInfo = new QSystemDeviceInfo(this);
    connect(_devInfo, SIGNAL(powerStateChanged(QSystemDeviceInfo::PowerState)), this, SLOT(powerStateChanged(QSystemDeviceInfo::PowerState)));
}
Example #8
0
void Dialog::setupDevice()
{
    delete di;
//! [createdi]
    di = new QSystemDeviceInfo(this);
//! [createdi]
//! [batteryLevel]
    batteryLevelBar->setValue(di->batteryLevel());
//! [batteryLevel]

//! [sig batteryLevelChanged]
    connect(di,SIGNAL(batteryLevelChanged(int)),
            this,SLOT(updateBatteryStatus(int)));
//! [sig batteryLevelChanged]

    connect(di,SIGNAL(batteryStatusChanged(QSystemDeviceInfo::BatteryStatus)),
            this,SLOT(displayBatteryStatus(QSystemDeviceInfo::BatteryStatus)));

    connect(di,SIGNAL(powerStateChanged(QSystemDeviceInfo::PowerState)),
            this,SLOT(updatePowerState(QSystemDeviceInfo::PowerState)));

    ImeiLabel->setText(di->imei());
    imsiLabel->setText(di->imsi());
//! [manuf-id]
    manufacturerLabel->setText(di->manufacturer());
//! [manuf-id]
    modelLabel->setText(di->model());
//! [productName]
    productLabel->setText(di->productName());
//! [productName]

    deviceLockPushButton->setChecked(di->isDeviceLocked());

    updateSimStatus();
    updateProfile();

    connect(di, SIGNAL(currentProfileChanged(QSystemDeviceInfo::Profile)),
        this, SLOT(updateProfile(QSystemDeviceInfo::Profile)));

    if(di->currentPowerState() == QSystemDeviceInfo::BatteryPower) {
        radioButton_2->setChecked(true);
    } else  if(di->currentPowerState() == QSystemDeviceInfo::WallPower) {
        radioButton_3->setChecked(true);
    } else if(di->currentPowerState() == QSystemDeviceInfo::WallPowerChargingBattery) {
        radioButton_4->setChecked(true);
    } else {
        radioButton->setChecked(true);
    }

//! [inputMethod flags]
    QSystemDeviceInfo::InputMethodFlags methods = di->inputMethodType();
    QStringList inputs;
    if((methods & QSystemDeviceInfo::Keys)){
        inputs << "Keys";
    }
    if((methods & QSystemDeviceInfo::Keypad)) {
        inputs << "Keypad";
    }
//! [inputMethod flags]
    if((methods & QSystemDeviceInfo::Keyboard)) {
        inputs << "Keyboard";
    }
    if((methods & QSystemDeviceInfo::SingleTouch)) {
        inputs << "Touch Screen";
    }
    if((methods & QSystemDeviceInfo::MultiTouch)) {
        inputs << "Multi touch";
    }
    if((methods & QSystemDeviceInfo::Mouse)){
        inputs << "Mouse";
    }

    inputMethodLabel->setText(inputs.join(" "));
}