ProximityAdaptorEvdev::ProximityAdaptorEvdev(const QString& id) :
    InputDevAdaptor(id, 1),
    currentState_(ProximityStateUnknown)
{
    proximityBuffer_ = new DeviceAdaptorRingBuffer<ProximityData>(1);
    setAdaptedSensor("proximity", "Proximity state", proximityBuffer_);
}
示例#2
0
AccelerometerAdaptor::AccelerometerAdaptor(const QString& id) :
    InputDevAdaptor(id, 1)
{
    accelerometerBuffer_ = new DeviceAdaptorRingBuffer<OrientationData>(1);
    setAdaptedSensor("accelerometer", "Internal accelerometer coordinates", accelerometerBuffer_);
    setDescription("Input device accelerometer adaptor (lis302d)");
}
IioAdaptor::IioAdaptor(const QString& id) :
        SysfsAdaptor(id, SysfsAdaptor::IntervalMode, true)
{
    int i;

    sensordLogD() << "Creating IioAdaptor with id: " << id;

    dev_accl_ = sensorExists(IIO_ACCELEROMETER);
    dev_gyro_ = -1;/*sensorExists(IIO_GYROSCOPE);*/
    dev_magn_ = -1;/*sensorExists(IIO_MAGNETOMETER);*/

    if (dev_accl_ != -1) {
        iioAcclBuffer_ = new DeviceAdaptorRingBuffer<TimedXyzData>(1);
        QString desc = "Industrial I/O accelerometer (" +  devices_[dev_accl_].name +")";
        sensordLogD() << "Accelerometer found";
        setAdaptedSensor("accelerometer", desc, iioAcclBuffer_);
    }

    if (dev_gyro_ != -1) {
        iioGyroBuffer_ = new DeviceAdaptorRingBuffer<TimedXyzData>(1);
        QString desc = "Industrial I/O gyroscope (" + devices_[dev_gyro_].name +")";
        sensordLogD() << "Gyroscope found";
        setAdaptedSensor("gyroscope", desc, iioGyroBuffer_);
    }

    if (dev_magn_ != -1) {
        iioMagnBuffer_ = new DeviceAdaptorRingBuffer<TimedXyzData>(1);
        QString desc = "Industrial I/O magnetometer (" + devices_[dev_magn_].name +")";
        sensordLogD() << "Magnetometer found";
        setAdaptedSensor("magnetometer", desc, iioMagnBuffer_);
    }

    // Disable and then enable devices to make sure they allow changing settings
    for (i = 0; i < IIO_MAX_DEVICES; ++i) {
        if (dev_accl_ == i || dev_gyro_ == i || dev_magn_ == i) {
            deviceEnable(i, false);
            deviceEnable(i, true);
            addDevice(i);
        }
    }
    
    //introduceAvailableDataRange(DataRange(0, 65535, 1));

    setAdaptedSensor("accelerometer", "IIO Accelerometer", iioAcclBuffer_);
    setDescription("Sysfs Industrial I/O sensor adaptor");

}
示例#4
0
GyroscopeAdaptor::GyroscopeAdaptor(const QString& id) :
        SysfsAdaptor(id, SysfsAdaptor::SelectMode)
{
    gyroscopeBuffer_ = new DeviceAdaptorRingBuffer<TimedXyzData>(1);
    setAdaptedSensor("gyroscope", "l3g4200dh", gyroscopeBuffer_);
    setDescription("Sysfs Gyroscope adaptor (l3g4200dh)");   
    dataRatePath_ = Config::configuration()->value("gyroscope/path_datarate").toByteArray();
}
ProximityAdaptorEvdev::ProximityAdaptorEvdev(const QString& id) :
    InputDevAdaptor(id, 1),
    currentState_(ProximityStateUnknown)
{
    proximityBuffer_ = new DeviceAdaptorRingBuffer<ProximityData>(1);
    setAdaptedSensor("proximity", "Proximity state", proximityBuffer_);
    powerStatePath_ = Config::configuration()->value("proximity/powerstate_path").toByteArray();
}
示例#6
0
HybrisProximityAdaptor::HybrisProximityAdaptor(const QString& id) :
    HybrisAdaptor(id,SENSOR_TYPE_PROXIMITY)
{
    buffer = new DeviceAdaptorRingBuffer<ProximityData>(1);
    setAdaptedSensor("proximity", "Internal proximity coordinates", buffer);

    setDescription("Hybris proximity");
}
HybrisGyroscopeAdaptor::HybrisGyroscopeAdaptor(const QString& id) :
    HybrisAdaptor(id,SENSOR_TYPE_GYROSCOPE)
{
    buffer = new DeviceAdaptorRingBuffer<TimedXyzData>(1);
    setAdaptedSensor("gyroscopeadaptor", "Internal gyroscope coordinates", buffer);

    setDescription("Hybris gyroscope");
    setDefaultInterval(50);
}
HybrisOrientationAdaptor::HybrisOrientationAdaptor(const QString& id) :
    HybrisAdaptor(id,SENSOR_TYPE_ORIENTATION)
{
    buffer = new DeviceAdaptorRingBuffer<TimedXyzData>(1);
    setAdaptedSensor("orientation", "Internal orientation coordinates", buffer);

    setDescription("Hybris orientation");
//    setDefaultInterval(50);
}
示例#9
0
MagnetometerAdaptor::MagnetometerAdaptor(const QString& id) :
    SysfsAdaptor(id, SysfsAdaptor::IntervalMode, false)
{
    intervalCompensation_ = Config::configuration()->value<int>("magnetometer/interval_compensation", 0);
    magnetometerBuffer_ = new DeviceAdaptorRingBuffer<CalibratedMagneticFieldData>(1);
    setAdaptedSensor("magnetometer", "Internal magnetometer coordinates", magnetometerBuffer_);
    overflowLimit_ = Config::configuration()->value<int>("magnetometer/overflow_limit", 8000);
    setDescription("Input device Magnetometer adaptor (ak897x)");
}
HybrisAccelerometerAdaptor::HybrisAccelerometerAdaptor(const QString& id) :
    HybrisAdaptor(id,SENSOR_TYPE_ACCELEROMETER)
{
    buffer = new DeviceAdaptorRingBuffer<AccelerationData>(1);
    setAdaptedSensor("accelerometer", "Internal accelerometer coordinates", buffer);

    setDescription("Hybris accelerometer");
//    setDefaultInterval(50);
}
示例#11
0
ProximityAdaptor::ProximityAdaptor(const QString& id) :
    SysfsAdaptor(id, SysfsAdaptor::SelectMode, false)
{
    deviceType_ = (DeviceType)Config::configuration()->value<int>("proximity/driver_type", 0);
    threshold_ = Config::configuration()->value<int>("proximity/threshold", 35);
    powerStatePath_ = Config::configuration()->value("proximity/powerstate_path").toByteArray();
    proximityBuffer_ = new DeviceAdaptorRingBuffer<ProximityData>(1);
    setAdaptedSensor("proximity", "Proximity state", proximityBuffer_);
    setDescription("Proximity sensor readings (Dipro sensor)");
}
示例#12
0
ALSAdaptorAscii::ALSAdaptorAscii(const QString& id) : SysfsAdaptor(id, SysfsAdaptor::IntervalMode)
{
    memset(buf, 0x0, 16);
    alsBuffer_ = new DeviceAdaptorRingBuffer<TimedUnsigned>(1);
    setAdaptedSensor("als", "Internal ambient light sensor lux values", alsBuffer_);
    setDescription("Ambient light");

    // Get range from a file, if the path is found in configuration
    QString rangeFilePath_ = Config::configuration()->value("als/range_file_path",QVariant("")).toString();
    if (rangeFilePath_ != "") {
        QFile sysFile(rangeFilePath_);

        if (!(sysFile.open(QIODevice::ReadOnly))) {
            sensordLogW() << "Unable to config ALS range from sysfs";
        } else {
            sysFile.readLine(buf, sizeof(buf));
            int range = QString(buf).toInt();

            introduceAvailableDataRange(DataRange(0, range, 1));
            sensordLogT() << "Ambient light range: " << range;
        }
    }
}
PegatronAccelerometerAdaptor::PegatronAccelerometerAdaptor(const QString& id) :
    InputDevAdaptor(id, 1)
{
    //This was previously in the base class, but it's not
    //possible call virtual methods from base class constructor.
    //TODO: find a way to get rid of all child classes calling this
    //manually.

    sleep(5);

    if (!getInputDevices(DEVICE_MATCH_STRING)) {
        sensordLogW() << "Input device not found.";
    }

    accelerometerBuffer_ = new DeviceAdaptorRingBuffer<OrientationData>(128);
    setAdaptedSensor("accelerometer", "Internal accelerometer coordinates", accelerometerBuffer_);

    // Set Metadata
    setDescription("Input device accelerometer adaptor (Pegtron Lucid Tablet)");
    introduceAvailableDataRange(DataRange(-512, 512, 1));
    introduceAvailableInterval(DataRange(0, 0, 0));
    introduceAvailableInterval(DataRange(50, 2000, 0)); // -> [1,100] Hz
    setDefaultInterval(300);
}
SteAccelAdaptor::SteAccelAdaptor(const QString& id) :
    SysfsAdaptor(id, SysfsAdaptor::IntervalMode)
{
    buffer = new DeviceAdaptorRingBuffer<OrientationData>(128);
    setAdaptedSensor("accelerometer", "ste accelerometer", buffer);
    introduceAvailableInterval(DataRange(50, 1000, 0));

/*
range
0: +/- 2g (1 mg/LSB)
1: +/- 4g (2 mg/LSB)
2: +/- 8g (4 mg/LSB)
*/
    QByteArray rangePath = Config::configuration()->value("accelerometer/range_path").toByteArray();
    range = Config::configuration()->value("accelerometer/range_mode").toByteArray();
    if(!rangePath.isEmpty()) {
        writeToFile(rangePath, range);
    }

    /*
power_state/frequency
     0: off
     1: 1 Hz
     2: 10 Hz
     3: 25 Hz
     4: 50 Hz
     5: 100 Hz
     6: 200 Hz
     7: 400 Hz
     */

    powerStatePath = Config::configuration()->value("accelerometer/mode_path").toByteArray();
    frequency = Config::configuration()->value("accelerometer/frequency_mode").toInt();

    setDescription("ste accelerometer");
}
示例#15
0
ALSAdaptorSysfs::ALSAdaptorSysfs(const QString& id) :
    SysfsAdaptor(id, SysfsAdaptor::IntervalMode, true)
{
    alsBuffer_ = new DeviceAdaptorRingBuffer<TimedUnsigned>(1);
    setAdaptedSensor("als", "Internal ambient light sensor lux values", alsBuffer_);
}