Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #14 from lpotter/master
[sensorfw] add logic to hybris suspend and resume
  • Loading branch information
lpotter committed Oct 7, 2013
2 parents aa7b925 + 30112b0 commit aca2a45
Showing 1 changed file with 45 additions and 2 deletions.
47 changes: 45 additions & 2 deletions core/hybrisadaptor.cpp
Expand Up @@ -371,13 +371,56 @@ void HybrisAdaptor::stopSensor()

bool HybrisAdaptor::standby()
{
return false;
sensordLogD() << "Adaptor '" << id() << "' requested to go to standby";
if (inStandbyMode_) {
sensordLogD() << "Adaptor '" << id() << "' not going to standby: already in standby";
return false;
}
if (deviceStandbyOverride()) {
sensordLogD() << "Adaptor '" << id() << "' not going to standby: overriden";
return false;
}
inStandbyMode_ = true;

if (!isRunning()) {
sensordLogD() << "Adaptor '" << id() << "' not going to standby: not running";
return false;
}

sensordLogD() << "Adaptor '" << id() << "' going to standby";
stopReaderThread();

running_ = false;
return true;
}


bool HybrisAdaptor::resume()
{
return false;
sensordLogD() << "Adaptor '" << id() << "' requested to resume from standby";

// Don't resume if not in standby
if (!inStandbyMode_) {
sensordLogD() << "Adaptor '" << id() << "' not resuming: not in standby";
return false;
}

inStandbyMode_ = false;

if (!shouldBeRunning_) {
sensordLogD() << "Adaptor '" << id() << "' not resuming from standby: not running";
return false;
}

sensordLogD() << "Adaptor '" << id() << "' resuming from standby";

if (!startReaderThread()) {
sensordLogW() << "Adaptor '" << id() << "' failed to resume from standby!";
return false;
}

running_ = true;
return true;
}

unsigned int HybrisAdaptor::interval() const
Expand Down

0 comments on commit aca2a45

Please sign in to comment.