void PTExchangeAtIgnition();
/**
+ * Initializes PT exchange at user request
+ * @param correlation_id correlation id of request
+ */
+ void PTExchangeAtUserRequest(uint32_t correlation_id);
+
+ /**
* @brief Save device info for specific device to policy table
* @param device_id Device mac address
* @param device_info Device params
command.reset(new commands::OnSDLConsentNeededNotification(message));
break;
}
- /*
case hmi_apis::FunctionID::SDL_UpdateSDL: {
- if (is_response) {
- command.reset(new commands::UpdateSDLResponse(message));
- } else {
- command.reset(new commands::UpdateSDLRequest(message));
+ if (is_response) {
+ command.reset(new commands::UpdateSDLResponse(message));
+ } else {
+ command.reset(new commands::UpdateSDLRequest(message));
+ }
+ break;
}
- break;
- */
case hmi_apis::FunctionID::BasicCommunication_OnIgnitionCycleOver: {
command.reset(new commands::OnIgnitionCycleOverNotification(message));
break;
ApplicationManagerImpl::instance()->ManageHMICommand(message);
}
+void MessageHelper::SendUpdateSDLResponse(const std::string& result,
+ uint32_t correlation_id) {
+ smart_objects::SmartObject* message = new smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
+ if (!message) {
+ return;
+ }
+
+ (*message)[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::SDL_UpdateSDL;
+ (*message)[strings::params][strings::message_type] =
+ MessageType::kResponse;
+ (*message)[strings::params][strings::correlation_id] = correlation_id;
+ (*message)[strings::params][hmi_response::code] = 0;
+
+ (*message)[strings::msg_params]["result"] = result;
+
+ ApplicationManagerImpl::instance()->ManageHMICommand(message);
+}
+
void MessageHelper::SendGetUserFriendlyMessageResponse(
const std::vector<policy::UserFriendlyMessage>& msg,
uint32_t correlation_id) {
event_observer_.get()->subscribe_on_event(
hmi_apis::FunctionID::VehicleInfo_GetVehicleData, correlation_id);
application_manager::MessageHelper::CreateGetDeviceData(correlation_id);
- // TODO(KKolodiy): when we must reset counter of ignition cyles, update days
- // and kms?
}
return ret;
}
}
}
- // TODO(KKolodiy): when we must reset counter of ignition cyles,
- // update days and kms?
-
retry_sequence_lock_.Ackquire();
retry_sequence_.stop();
policy_manager_->ResetRetrySequence();
}
}
+void PolicyHandler::PTExchangeAtUserRequest(uint32_t correlation_id) {
+ LOG4CXX_TRACE(logger_, "PT exchange at user request");
+ policy::PolicyTableStatus status = policy_manager_->GetPolicyTableStatus();
+ if (status == policy::StatusUpdateRequired) {
+ OnPTExchangeNeeded();
+ status = policy::StatusUpdatePending;
+ }
+ application_manager::MessageHelper::SendUpdateSDLResponse(
+ ConvertUpdateStatus(status), correlation_id);
+}
+
void PolicyHandler::OnPTExchangeNeeded() {
StartPTExchange();
}