• spiiroin's avatar
    [sensorfw] Fix initial proximity sensor state evaluation. Fixes JB#38675 · 68b8c97e
    spiiroin authored
    The sensorfw plugin assumes that both proximity state query and change
    notifications use the same withinProximity boolean type values. Because
    the state query actually returns integer distance, the initial value
    visible in for example QML ProximitySensor is logically reversed from
    what it should be and it requires one or two sensor state transitions
    before changes get notified in the expected manner.
    
    Evaluate initial proximity state as "distance" value where zero means
    that the sensor is covered.
    
    Also use the initial value to setup the cached previously seen value
    instead of blindly assuming that sensor is not covered.
    
    As suggested in sensorfwd documentation: Switch from deprecated
    dataAvailable() signal to reflectanceDataAvailable() signal.
    Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
    68b8c97e
sensorfwproximitysensor.cpp 3.78 KB