-
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/resumption during low voltage #2412
Feature/resumption during low voltage #2412
Conversation
* @return Low Voltage event timestamp if event LOV VOLTAGE event occures | ||
* otherwise 0 | ||
*/ | ||
time_t LowVoltageTime() const OVERRIDE; |
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 duplication of comments in implementation and interface
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 Done in 93ff02d
/** | ||
* @brief Resets Low Voltage signal timestamp to zero | ||
*/ | ||
virtual void ResetLowVoltageTime() = 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.
@AByzhynar check if this functions should be public in interface
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 Done in 93ff02d
* @brief Checks if saved HMI level is allowed for resumption | ||
* by Ignition Cycle restrictions | ||
* @param saved_app application specific section from backup file | ||
* @return True is allowed , othrwise - 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.
@AByzhynar typo
true if allowed
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 Done in 93ff02d
resume_controller().SaveApplication(app_to_remove); | ||
} else { | ||
resume_controller().RemoveApplicationFromSaved(app_to_remove); | ||
if (!IsLowVoltage()) { |
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 move low voltage check to ResumeCtrl
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 Done in 93ff02d
LOG4CXX_INFO(logger_, "Application was dissconnected long before ign off"); | ||
result = false; | ||
if (!CheckDelayBeforeIgnOff(saved_app)) { | ||
LOG4CXX_INFO(logger_, "Application was disconnected long before ign off"); |
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 rename to debug
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 Done in 93ff02d
3c9dd5c
to
94730fa
Compare
static_cast<time_t>(resumption_storage_->GetIgnOffTime()); | ||
|
||
if (0 == ign_off_time) { | ||
return true; |
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 in case if function has multiple returns please log information about return reason
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 Done in 93ff02d
sync_primitives::AutoLock autolock(resumption_lock_); | ||
Json::Value& resumption = GetResumptionData(); | ||
if (!resumption.isMember(strings::global_ign_on_counter)) { | ||
resumption[strings::global_ign_on_counter] = 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.
@AByzhynar it is not expected that getter will change data.
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 Absolutely agree
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 Done in 93ff02d
sync_primitives::AutoLock autolock(resumption_lock_); | ||
Json::Value& resumption = GetResumptionData(); | ||
if (!resumption.isMember(strings::global_ign_off_counter)) { | ||
resumption[strings::global_ign_off_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.
@AByzhynar it is not expected that getter will change data.
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 Done in 93ff02d
@@ -124,6 +124,40 @@ class ResumeCtrl { | |||
*/ | |||
virtual void OnAwake() = 0; | |||
|
|||
/** | |||
* @brief Returns Low Voltage signal timestamp | |||
* @return Low Voltage event timestamp if event LOV VOLTAGE event occures |
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 Low Voltage event timestamp if LOV VOLTAGE event occures
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 Done in 93ff02d
* @return Wake Up timestamp if Wake Up signal occures | ||
* otherwise 0 | ||
*/ | ||
time_t WakeUpTime() const; |
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 I would suggest to create enum like TimestampType{LOW_VOLTAGE, WAKE_UP}
And then you could reduce count of functions:
- GetTime(TimestampType)
- SaveTime(TimestampType)
- ResetTime(TimestampType)
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.
@AKalinich-Luxoft Disagree. it is the same type for all events. I don't see any reason to complicate the code.
* Ignition Off, | ||
* otherwise return false | ||
*/ | ||
bool CheckDelayBeforeIgnOff(const smart_objects::SmartObject& saved_app); |
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 could these check functions be const?
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 Done in 93ff02d
|
||
/** | ||
* @brief Returns Low Voltage signal timestamp | ||
* @return Low Voltage event timestamp if event LOV VOLTAGE event occures |
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 redundant event word
@return Low Voltage event timestamp if LOV VOLTAGE event occures
const uint32_t global_ign_on_count = | ||
resumption_storage_->GetGlobalIgnOnCounter(); | ||
const uint32_t diff = global_ign_on_count - global_ign_off_count; | ||
if (diff >= 2) { |
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 could be moved to a separate const with a meaningful name
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 Done in 93ff02d
2be4522
to
e8c27a3
Compare
e8c27a3
to
c073062
Compare
c073062
to
7ec0f18
Compare
65c39a3
to
4506e6d
Compare
fc1c822
to
93ff02d
Compare
|
||
void ResumeCtrlImpl::ResetLowVoltageTime() { | ||
low_voltage_time_ = 0; | ||
LOG4CXX_DEBUG(logger_, "Resetting Low Voltage timestamp :"); |
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 redundant semicolon
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 Done and squashed.
|
||
void ResumeCtrlImpl::ResetWakeUpTime() { | ||
wake_up_time_ = 0; | ||
LOG4CXX_DEBUG(logger_, "Resetting Wake Up timestamp :"); |
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 redundant semicolon
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 Done and squashed.
5328fdc
to
36d137b
Compare
Implemented resumption logic during Low Voltage (used app_info.dat file for resumption.Configurable in smartdevicelink.ini file)
36d137b
to
24b20e8
Compare
Fixes #2233
This PR is [ready] for review.
Risk
This PR makes [no] API changes.
Testing Plan
Unit tests will be provided
ATF tests will be provided
Summary
Added resumption logic during Low Voltage event
CLA