예제 #1
0
DeviceManager::DeviceError DevicePluginMock::discoverDevices(const DeviceClassId &deviceClassId, const ParamList &params)
{
    Q_UNUSED(deviceClassId)
    qCDebug(dcMock) << "starting mock discovery:" << params;
    m_discoveredDeviceCount = params.paramValue("resultCount").toInt();
    QTimer::singleShot(1000, this, SLOT(emitDevicesDiscovered()));
    return DeviceManager::DeviceErrorAsync;
}
예제 #2
0
DeviceManager::DeviceError DevicePluginDateTime::discoverDevices(const DeviceClassId &deviceClassId, const ParamList &params)
{
    Q_UNUSED(deviceClassId);

    QList<DeviceDescriptor> deviceDescriptors;
    foreach (QByteArray timeZone, QTimeZone::availableTimeZoneIds()) {
        QByteArray continent = params.paramValue("continent").toByteArray();
        if(timeZone.contains(continent)){
            DeviceDescriptor descriptor(dateTimeDeviceClassId, timeZone.right(timeZone.length() - (continent.length() + 1)), continent);
            ParamList params;
            params.append(Param("timezone", timeZone));
            descriptor.setParams(params);
            deviceDescriptors.append(descriptor);
        }
    }