-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Feature/low voltage #2418
Feature/low voltage #2418
Conversation
src/appMain/life_cycle_impl.h
Outdated
void StopComponents() OVERRIDE; | ||
|
||
/** | ||
* Makes appropriate actions when Low Voltage signal received: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AByzhynar please avoid Doxygen comments overriden functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LuxoftAKutsan Thank you. Removed in 0f82294
if (is_ign_off_record_missed) { | ||
LOG4CXX_WARN(logger_, | ||
"Some IGN OFF records missed. Possibly due to Low Voltage"); | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yang1070 I will reset global counters after normal IGNITION OFF flow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yang1070 We found a betters and more simple solution. We will use only one IGN_ON counter and will reset it in normal IGNITION OFF flow. Code will be provided in separate commit later.
@@ -1203,6 +1229,227 @@ TEST_F(ResumeCtrlTest, GetSavedAppHmiLevel_AskedAppFound_INVALID_ENUM) { | |||
res_ctrl_->GetSavedAppHmiLevel(kTestPolicyAppId_, kMacAddress_)); | |||
} | |||
|
|||
TEST_F(ResumeCtrlTest, ResumptiLowVoltage_AppInFull_Restored) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ZhdanovP Check typo here please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yang1070 @AByzhynar the names were fixed at 7f61588
return true; | ||
} | ||
|
||
void LifeCycleImpl::LowVoltage() { | ||
LOG4CXX_AUTO_TRACE(logger_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please keep this log, but identify and remove others logs that happens after sdl receives low voltage signal.
we can keep the logs after sdl receives wake up signal.
protocol_handler::ProtocolHandlerImpl* protocol_handler_; | ||
connection_handler::ConnectionHandlerImpl* connection_handler_; | ||
application_manager::ApplicationManagerImpl* app_manager_; | ||
std::unique_ptr<LowVoltageSignalsHandler> low_voltage_signals_handler_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this one is unique_ptr, but others are normal pointers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yang1070 because std::unique_ptr<LowVoltageSignalsHandler> low_voltage_signals_handler_;
is the new code and the other pointers are old code. Therefore I don't want to make changes unrelated to feature.
7f61588
to
f9a741b
Compare
@@ -335,6 +347,37 @@ void ResumeCtrlImpl::OnAwake() { | |||
StartSavePersistentDataTimer(); | |||
} | |||
|
|||
void ResumeCtrlImpl::SaveLowVoltageTime() { | |||
ResetLowVoltageTime(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do this extra reset?
low_voltage_time_ = 0;
low_voltage_time_= new value;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
void ResumeCtrlImpl::SaveWakeUpTime() { | ||
ResetWakeUpTime(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do this extra reset?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f9a741b
to
0f82294
Compare
79c68f2
to
1c66a5e
Compare
@@ -313,6 +313,9 @@ extern const char* resume_vr_grammars; | |||
|
|||
extern const char* ign_off_count; | |||
|
|||
extern const char* global_ign_on_counter; | |||
extern const char* global_ign_off_counter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need this counter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -276,6 +276,8 @@ const char* last_ign_off_time = "last_ign_off_time"; | |||
const char* resume_vr_grammars = "resumeVrGrammars"; | |||
|
|||
const char* ign_off_count = "ign_off_count"; | |||
const char* global_ign_on_counter = "global_ign_on_counter"; | |||
const char* global_ign_off_counter = "global_ign_off_counter"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove global_ign_off_counter
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yang1070 Agree. Thanks. Will remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resumption_storage_->IncrementIgnOffCount(); | ||
FinalPersistData(); | ||
if (!application_manager_.IsLowVoltage()) { | ||
resumption_storage_->IncrementIgnOffCount(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still need IncrementIgnOffCount()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yang1070 This is different counter. Not for low Voltage handling. It existed before and used for different purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need ign off counter?
@yang1070 We don't need global ignition counter. We have removed it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good.
@theresalech Ford has reviewed, tested and approved this change. It is ready for Livio to review. |
src/appMain/life_cycle_impl.cc
Outdated
#ifdef DBUS_HMIADAPTER | ||
, dbus_adapter_(NULL) | ||
, dbus_adapter_thread_(NULL) | ||
#endif // DBUS_HMIADAPTER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove, dbus adapter was removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacobkeeler all mentions of DBUS_HMIADAPTER removed
src/appMain/life_cycle_impl.cc
Outdated
return true; | ||
} | ||
#endif // DBUS_HMIADAPTER | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dbus adapter was removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacobkeeler 'Removing Dbus' - is the change not related to the feature. I think that it is more correct way - to remove it in separate PR.
Or should we remove it within this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was removed in a previous PR, but this PR seems to be adding this logic back in where it previously existed. I am just asking that it not be added in again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacobkeeler fixed 0f738f7
src/appMain/life_cycle_impl.cc
Outdated
delete dbus_adapter_thread_; | ||
dbus_adapter_thread_ = NULL; | ||
} | ||
#endif // DBUS_HMIADAPTER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dbus adapter was removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacobkeeler fixed 0f738f7
@@ -33,6 +33,8 @@ | |||
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUME_CTRL_IMPL_H_ | |||
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUME_CTRL_IMPL_H_ | |||
|
|||
#include "application_manager/resumption/resume_ctrl.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why move the include?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacobkeeler according to SDL C++ Coding Style
void HandleSignal(const int signo); | ||
|
||
/** | ||
* @brief Returns signals mask required for handlning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo, should be handling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacobkeeler fixed 50d98d3
*/ | ||
bool CheckLowVoltageRestrictions(const smart_objects::SmartObject& saved_app); | ||
|
||
DEPRECATED bool DisconnectedJustBeforeIgnOff( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can just be removed since this is being included in the 5.0.0 release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacobkeeler removed cca195b
@@ -409,10 +454,37 @@ class ResumeCtrlImpl : public ResumeCtrl, | |||
|
|||
/** | |||
* @brief CheckDelayAfterIgnOn should check if SDL was started less | |||
* then N seconds ago. N will be readed from profile. | |||
* then N seconds ago. N will be read from profile. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may as well fix the typo with than
while you are at it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacobkeeler fixed d176706
|
||
/** | ||
* @brief CheckDelayBeforeIgnOff checks if app was unregistered less | ||
* then N seconds before Ignition OFF. N will be read from profile. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
than N seconds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacobkeeler fixed d176706
|
||
/** | ||
* @brief CheckDelayAfterWakeUp should check if app was registered | ||
* during N seconds after WakeUp signal. N will be read from profile. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
during the first N seconds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacobkeeler fixed 8043e15
resumption_storage_->GetGlobalIgnOnCounter(); | ||
const uint32_t allowed_ign_on_value = 2; | ||
const bool is_emergency_ign_off_occurred = | ||
global_ign_on_count >= allowed_ign_on_value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be allowed_ign_on_value = 1
and global_ign_on_count > allowed_ign_on_value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacobkeeler in that case constant allowed_ign_on_value should be renamed and it is hard for me to imagine the name in that case : maximum_not_allowed_ignition_on_occured
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
} | ||
LOG4CXX_ERROR(logger_, "Problem with prepare query"); | ||
return global_ign_on_counter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just return 0
here and reduce scope of global_ign_on_counter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOG4CXX_DEBUG(logger_, "Global Ign On Counter = " << global_ign_on_counter); | ||
return global_ign_on_counter; | ||
} | ||
return 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems default would be 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacobkeeler if SDL is alive, at least one ignition on occurred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Equivalent change should be made to resumption_data_db.cc
then, since the default is 0
there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacobkeeler fixed 19cca45
const mobile_apis::HMILevel::eType restored_test_type = eType::HMI_FULL; | ||
const uint32_t time_offset = 5; | ||
const uint32_t time_stamp = | ||
time(nullptr) - resumption_delay_before_ign_ + time_offset; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this should be - time_offset
rather than + time_offset
based on the description. Although it does seem that this test would be prone to occasional failures, since Core grabs the timestamp separately from the test (as far as I can see).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacobkeeler On the border it means that app was unregistered in the frame of 30 seconds before low voltage and application should restore it's HMI level. So there should be + time_offset
.
Here is the example: [----|-----u-----L]
|
- 30 seconds frame before the low voltageu
- unregistering applicationL
- low voltage event
In case if there will be - time_offset
there will be the following picture :
[---u---|----L]
, and Application will not restore it's HMI level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understood "on the border" as "exactly 30 seconds before LOW_VOLTAGE".
Another thing to note here is that the time_offset
is added to the delay in this particular test case, so the window is 35
seconds.
EXPECT_CALL(app_mngr_settings_, resumption_delay_before_ign())
.WillOnce(Return(resumption_delay_before_ign_ + time_offset));
If this is just testing when an app unregisters within the time frame, then this case is redundant, as that case is covered by ResumptionLowVoltage_AppInFullUnregisteredWithinTimeFrame_HMILevelRestored
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacobkeeler fixed 33e6dd4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacobkeeler removed 5224964
@@ -532,6 +532,8 @@ int TransportManagerImpl::Reinit() { | |||
LOG4CXX_AUTO_TRACE(logger_); | |||
DisconnectAllDevices(); | |||
TerminateAllAdapters(); | |||
device_to_adapter_map_.clear(); | |||
connection_id_counter_ = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes don't appear relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After LowVoltage and Wake Up we should clear old devices from list
8043e15
to
f51a338
Compare
const bool is_emergency_ign_off_occurred = | ||
global_ign_on_count >= allowed_ign_on_value; | ||
global_ign_on_count > the_first_ignition; | ||
// In case of resumption it should be minimum second ignition cycle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment does not match the functionality. This count is reset on IGNITION_OFF
, so a value greater than 1
means that the project was shut down by force. A value of 1
does not meant that it is the first ignition cycle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacobkeeler fixed 06ce5d9
LOG4CXX_DEBUG(logger_, | ||
"Global Ign On Counter = " << global_ign_on_counter); | ||
return global_ign_on_counter; | ||
} else { | ||
LOG4CXX_ERROR(logger_, | ||
"Problem with exec query : " << kSelectGlobalIgnOnCounter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This else
case is already covered, it will just continue on to the end of the function. This will just result in this log being printed twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacobkeeler fixed 24e9b7c
Created Life cycle class interface in order: - to make unit-testing available - to decrease components coupling
Implemented Low Voltage feature based on POSIX real-time signals
Implemented resumption logic during Low Voltage (used app_info.dat file for resumption.Configurable in smartdevicelink.ini file)
Removed redundant functions Simplified ingintion cycle data correctness check
Implemented Low Voltage functionality handling in separate process in order to have possibility to suspend entire SDL process in case of Low Voltage signal After receipt of WakeUp signal SDL process is beeing waken up and resumes all its activities.
33e6dd4
to
0d5978f
Compare
Fixes #2233
This PR is ready for review.
Risk
This PR makes no API changes.
Testing Plan
Unit tests are provided
ATF scripts are provided: smartdevicelink/sdl_atf_test_scripts#1953
Breaking Changes
Enhancements
Bug Fixes
Tasks Remaining:
Summary
Implemented SDL behavior during Low Voltage event including resumption flow.
CLA