diff --git a/src/autoapp/Service/SensorService.cpp b/src/autoapp/Service/SensorService.cpp index f6c05ef..2308fef 100644 --- a/src/autoapp/Service/SensorService.cpp +++ b/src/autoapp/Service/SensorService.cpp @@ -19,6 +19,8 @@ #include #include #include +#include +#include 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));