示例#1
0
/*!
    Creates a QHardwareManager object and attaches it to \a parent. \a interface is the
    name of the accessory interface that this object is monitoring.

    The following code assumes that Qtopia is running on a device that
    has a modem as power source (for more details see QPowerStatus and QPowerSource).
    \code
        QHardwareManager manager( "QPowerSource" );
        QStringList providers = manager.providers();
        
        //Qtopia always has a virtual power source with id DefaultBattery
        providers.contains( "DefaultBattery" ); //always true
        providers.contains( "modem" ); //true
    \endcode

    Another way to achieve the same as the above example would be:

    \code
        QStringList providers = QHardwareManager::providers<QPowerSource>();
        providers.contains( "DefaultBattery" ); //always true
        providers.contains( "modem" ); //true
    \endcode
*/
QHardwareManager::QHardwareManager( const QString& interface, QObject *parent )
    : QAbstractIpcInterfaceGroupManager( HARDWAREINTERFACE_VALUEPATH, interface, parent )
{
    d = new QHardwareManagerPrivate;
    d->interface = interface;
    connect( this, SIGNAL(groupAdded(QString)),
             this, SIGNAL(providerAdded(QString)) );
    connect( this, SIGNAL(groupRemoved(QString)),
             this, SIGNAL(providerRemoved(QString)) );
}
bool GdbServerProviderManager::registerProvider(GdbServerProvider *provider)
{
    if (!provider || m_providers.contains(provider))
        return true;
    foreach (const GdbServerProvider *current, m_providers) {
        if (*provider == *current)
            return false;
        QTC_ASSERT(current->id() != provider->id(), return false);
    }

    m_providers.append(provider);
    emit providerAdded(provider);
    return true;
}
示例#3
0
HtcuniversalModemService::HtcuniversalModemService
(const QString& service, QSerialIODeviceMultiplexer *mux,
  QObject *parent)
  : QModemService(service, mux, parent), manager(0), battery(0)
{
  connect(this, SIGNAL(resetModem()), this, SLOT(reset()));

  primaryAtChat()->registerNotificationType
    ("@HTCCSQ:", this, SLOT(signalQualityNotification(QString)));

  manager = new QHardwareManager("QPowerSource");
  connect(manager, SIGNAL(providerAdded(QString)),
	  this, SLOT(newBatteryAdded(QString)));

  indicators()->setBatteryCharge(100, 100, QModemIndicators::PoweredByBattery);
}