summaryrefslogtreecommitdiff
path: root/src/components/config_profile
diff options
context:
space:
mode:
authorAndriy Byzhynar <abyzhynar@luxoft.com>2018-06-27 14:53:12 +0300
committerAlexander <akutsan@luxoft.com>2018-08-21 12:30:03 +0300
commitd1308d1c87ff7176258fe43d14e70f04894e0494 (patch)
tree42e338c03c8b446239af18aedf477f815ed43d96 /src/components/config_profile
parentaf2f7dfa77e92694095104fe6949c412f8edf12e (diff)
downloadsdl_core-d1308d1c87ff7176258fe43d14e70f04894e0494.tar.gz
Initial implementation of Low Voltage feature
Implemented Low Voltage feature based on POSIX real-time signals
Diffstat (limited to 'src/components/config_profile')
-rw-r--r--src/components/config_profile/include/config_profile/profile.h24
-rw-r--r--src/components/config_profile/src/profile.cc49
2 files changed, 71 insertions, 2 deletions
diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h
index 4c2be53228..17437a04a3 100644
--- a/src/components/config_profile/include/config_profile/profile.h
+++ b/src/components/config_profile/include/config_profile/profile.h
@@ -110,6 +110,27 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
const std::string& app_resource_folder() const;
/**
+ * @brief Returns offset from SIGRTMIN for user defined signal
+ * SIGLOWVOLTAGE
+ * which is used for handling LOW Voltage functionality
+ */
+ int low_voltage_signal_offset() const;
+
+ /**
+ * @brief Returns offset from SIGRTMIN for user defined signal
+ * SIGWAKEUP
+ * which is used for handling LOW Voltage functionality
+ */
+ int wake_up_signal_offset() const;
+
+ /**
+ * @brief Returns offset from SIGRTMIN for user defined signal
+ * SIGIGNITIONOFF
+ * which is used for handling LOW Voltage functionality
+ */
+ int ignition_off_signal_offset() const;
+
+ /**
* @brief Returns true, if SDL 4.0 is enabled
* @deprecated use max_supported_protocol_version instead
*/
@@ -1018,6 +1039,9 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
std::vector<std::string> video_service_transports_;
bool error_occured_;
std::string error_description_;
+ int low_voltage_signal_offset_;
+ int wake_up_signal_offset_;
+ int ignition_off_signal_offset_;
DISALLOW_COPY_AND_ASSIGN(Profile);
};
diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc
index 3f3ec7eb63..d869d6b65e 100644
--- a/src/components/config_profile/src/profile.cc
+++ b/src/components/config_profile/src/profile.cc
@@ -222,6 +222,9 @@ const char* kEnableAppLaunchIOSKey = "EnableAppLaunchIOS";
const char* kAppTransportChangeTimerKey = "AppTransportChangeTimer";
const char* kAppTransportChangeTimerAdditionKey =
"AppTransportChangeTimerAddition";
+const char* kLowVoltageSignalOffsetKey = "LowVoltageSignal";
+const char* kWakeUpSignalOffsetKey = "WakeUpSignal";
+const char* kIgnitionOffSignalOffsetKey = "IgnitionOffSignal";
const char* kMultipleTransportsEnabledKey = "MultipleTransportsEnabled";
const char* kSecondaryTransportForBluetoothKey =
"SecondaryTransportForBluetooth";
@@ -372,6 +375,9 @@ const uint16_t kDefaultWaitTimeBetweenApps = 4000;
const bool kDefaultEnableAppLaunchIOS = true;
const uint32_t kDefaultAppTransportChangeTimer = 500u;
const uint32_t kDefaultAppTransportChangeTimerAddition = 0u;
+const int32_t kDefaultLowVoltageSignalOffset = 1;
+const int32_t kDefaultWakeUpSignalOffset = 2;
+const int32_t kDefaultIgnitionOffSignalOffset = 3;
const std::string kAllowedSymbols =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-";
const bool kDefaultMultipleTransportsEnabled = false;
@@ -485,7 +491,10 @@ Profile::Profile()
kDefaultAppTransportChangeTimerAddition)
, multiple_transports_enabled_(kDefaultMultipleTransportsEnabled)
, error_occured_(false)
- , error_description_() {
+ , error_description_()
+ , low_voltage_signal_offset_(kDefaultLowVoltageSignalOffset)
+ , wake_up_signal_offset_(kDefaultWakeUpSignalOffset)
+ , ignition_off_signal_offset_(kDefaultIgnitionOffSignalOffset) {
// SDL version
ReadStringValue(
&sdl_version_, kDefaultSDLVersion, kMainSection, kSDLVersionKey);
@@ -530,6 +539,18 @@ const std::string& Profile::app_resource_folder() const {
return app_resource_folder_;
}
+int Profile::low_voltage_signal_offset() const {
+ return low_voltage_signal_offset_;
+}
+
+int Profile::wake_up_signal_offset() const {
+ return wake_up_signal_offset_;
+}
+
+int Profile::ignition_off_signal_offset() const {
+ return ignition_off_signal_offset_;
+}
+
bool Profile::enable_protocol_4() const {
return max_supported_protocol_version_ >= 4;
}
@@ -2124,7 +2145,31 @@ void Profile::UpdateValues() {
kAppTransportChangeTimerAdditionKey,
kMainSection);
- ReadBoolValue(&multiple_transports_enabled_,
+ ReadIntValue(&low_voltage_signal_offset_,
+ kDefaultLowVoltageSignalOffset,
+ kMainSection,
+ kLowVoltageSignalOffsetKey);
+
+ LOG_UPDATED_VALUE(
+ low_voltage_signal_offset_, kLowVoltageSignalOffsetKey, kMainSection);
+
+ ReadIntValue(&wake_up_signal_offset_,
+ kDefaultWakeUpSignalOffset,
+ kMainSection,
+ kWakeUpSignalOffsetKey);
+
+ LOG_UPDATED_VALUE(
+ wake_up_signal_offset_, kWakeUpSignalOffsetKey, kMainSection);
+
+ ReadIntValue(&ignition_off_signal_offset_,
+ kDefaultIgnitionOffSignalOffset,
+ kMainSection,
+ kIgnitionOffSignalOffsetKey);
+
+ LOG_UPDATED_VALUE(
+ ignition_off_signal_offset_, kIgnitionOffSignalOffsetKey, kMainSection);
+
+ ReadBoolValue(&multiple_transports_enabled_,
kDefaultMultipleTransportsEnabled,
kMultipleTransportsSection,
kMultipleTransportsEnabledKey);