[code] Announce day / night mode to android auto
This commit is contained in:
parent
5440d0e3b0
commit
bdf2befaa2
@ -19,6 +19,8 @@
|
||||
#include <aasdk_proto/DrivingStatusEnum.pb.h>
|
||||
#include <f1x/openauto/Common/Log.hpp>
|
||||
#include <f1x/openauto/autoapp/Service/SensorService.hpp>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
|
||||
namespace f1x
|
||||
{
|
||||
@ -121,7 +123,17 @@ void SensorService::sendDrivingStatusUnrestricted()
|
||||
void SensorService::sendNightData()
|
||||
{
|
||||
aasdk::proto::messages::SensorEventIndication indication;
|
||||
indication.add_night_mode()->set_is_night(false);
|
||||
|
||||
QFileInfo nightSwitchFile("/tmp/night_mode_enabled");
|
||||
bool nightSwitchExists = nightSwitchFile.exists();
|
||||
|
||||
if (!nightSwitchExists) {
|
||||
OPENAUTO_LOG(error) << "[CS] [SensorService] Mode day triggered";
|
||||
indication.add_night_mode()->set_is_night(false);
|
||||
} else {
|
||||
indication.add_night_mode()->set_is_night(true);
|
||||
OPENAUTO_LOG(error) << "[CS] [SensorService] Mode night triggered";
|
||||
}
|
||||
|
||||
auto promise = aasdk::channel::SendPromise::defer(strand_);
|
||||
promise->then([]() {}, std::bind(&SensorService::onChannelError, this->shared_from_this(), std::placeholders::_1));
|
||||
|
Loading…
x
Reference in New Issue
Block a user