示例#1
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;
    }
}
示例#2
0
bool AMHighVoltageChannel::isOff() const{
	return powerState() == AMHighVoltageChannel::isPowerOff;
}
示例#3
0
void QCommDeviceController_Private::powerStateChanged()
{
    QCommDeviceController::PowerState state = powerState();

    emit m_parent->powerStateChanged(state);
}