Skip to content

Commit 1bb6c99

Browse files
committed
Updates according to proposal changes
Added new result codes for ServiceStatusUpdateReasonStructure
1 parent 5a4c919 commit 1bb6c99

File tree

6 files changed

+60
-5
lines changed

6 files changed

+60
-5
lines changed

src/components/interfaces/HMI_API.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3469,6 +3469,12 @@
34693469
<element name="INVALID_TIME" >
34703470
<description>When a Service is rejected because the system was unable to get a valid SystemTime from HMI, which is required for certificate authentication.</description>
34713471
</element>
3472+
<element name="PROTECTION_ENFORCED" >
3473+
<description>When a Service is rejected because the system configuration ini file requires the service must be protected, but the app asks for an unprotected service.</description>
3474+
</element>
3475+
<element name="PROTECTION_DISABLED" >
3476+
<description>When a mobile app requests a protected service, but the system starts an unprotected service instead.</description>
3477+
</element>
34723478
</enum>
34733479

34743480
<!-- App Services -->

src/components/protocol_handler/include/protocol_handler/service_status_update_handler.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ enum class ServiceStatus {
4949
SERVICE_START_FAILED,
5050
PTU_FAILED,
5151
CERT_INVALID,
52-
INVALID_TIME
52+
INVALID_TIME,
53+
PROTECTION_ENFORCED,
54+
PROTECTION_DISABLED
5355
};
5456

5557
/**

src/components/protocol_handler/src/handshake_handler.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ void HandshakeHandler::ProcessFailedHandshake(BsonObject& params,
225225
service_status_update_handler_.OnServiceUpdate(
226226
this->connection_key(),
227227
context_.service_type_,
228-
ServiceStatus::SERVICE_ACCEPTED);
228+
ServiceStatus::PROTECTION_DISABLED);
229229
protocol_handler_.SendStartSessionAck(context_.connection_id_,
230230
context_.new_session_id_,
231231
protocol_version_,

src/components/protocol_handler/src/protocol_handler_impl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1653,7 +1653,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
16531653
<< service_type << ", over transport: " << transport
16541654
<< ", disallowed by settings.");
16551655
service_status_update_handler_->OnServiceUpdate(
1656-
connection_key, service_type, ServiceStatus::SERVICE_START_FAILED);
1656+
connection_key, service_type, ServiceStatus::PROTECTION_ENFORCED);
16571657
SendStartSessionNAck(
16581658
connection_id, session_id, protocol_version, service_type);
16591659
return RESULT_OK;

src/components/protocol_handler/src/service_status_update_handler.cc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ void ServiceStatusUpdateHandler::OnServiceUpdate(
3030
using namespace hmi_apis;
3131
typedef utils::Optional<Common_ServiceStatusUpdateReason::eType>
3232
UpdateReasonOptional;
33+
LOG4CXX_AUTO_TRACE(logger_);
3334
auto hmi_service_type = GetHMIServiceType(service_type);
3435

3536
switch (service_status) {
@@ -78,6 +79,24 @@ void ServiceStatusUpdateHandler::OnServiceUpdate(
7879
Common_ServiceEvent::REQUEST_REJECTED,
7980
update_reason);
8081
}
82+
case ServiceStatus::PROTECTION_ENFORCED: {
83+
auto update_reason =
84+
Common_ServiceStatusUpdateReason::PROTECTION_ENFORCED;
85+
return listener_->ProcessServiceStatusUpdate(
86+
connection_key,
87+
hmi_service_type,
88+
Common_ServiceEvent::REQUEST_REJECTED,
89+
update_reason);
90+
}
91+
case ServiceStatus::PROTECTION_DISABLED: {
92+
auto update_reason =
93+
Common_ServiceStatusUpdateReason::PROTECTION_DISABLED;
94+
return listener_->ProcessServiceStatusUpdate(
95+
connection_key,
96+
hmi_service_type,
97+
Common_ServiceEvent::REQUEST_ACCEPTED,
98+
update_reason);
99+
}
81100
default: {
82101
LOG4CXX_WARN(logger_,
83102
"Received unknown ServiceStatus: "

src/components/protocol_handler/test/service_status_update_handler_test.cc

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ class ServiceStatusUpdateHandlerTest
7373

7474
Common_ServiceEvent::eType GetServiceEvent(ServiceStatus status) {
7575
switch (status) {
76-
case ServiceStatus::SERVICE_ACCEPTED: {
76+
case ServiceStatus::SERVICE_ACCEPTED:
77+
case ServiceStatus::PROTECTION_DISABLED: {
7778
return Common_ServiceEvent::REQUEST_ACCEPTED;
7879
}
7980
case ServiceStatus::SERVICE_RECEIVED: {
@@ -82,7 +83,8 @@ class ServiceStatusUpdateHandlerTest
8283
case ServiceStatus::SERVICE_START_FAILED:
8384
case ServiceStatus::PTU_FAILED:
8485
case ServiceStatus::CERT_INVALID:
85-
case ServiceStatus::INVALID_TIME: {
86+
case ServiceStatus::INVALID_TIME:
87+
case ServiceStatus::PROTECTION_ENFORCED: {
8688
return Common_ServiceEvent::REQUEST_REJECTED;
8789
}
8890
default: { return Common_ServiceEvent::INVALID_ENUM; }
@@ -108,6 +110,14 @@ class ServiceStatusUpdateHandlerTest
108110
auto reason = Common_ServiceStatusUpdateReason::INVALID_TIME;
109111
return reason;
110112
}
113+
case ServiceStatus::PROTECTION_ENFORCED: {
114+
auto reason = Common_ServiceStatusUpdateReason::PROTECTION_ENFORCED;
115+
return reason;
116+
}
117+
case ServiceStatus::PROTECTION_DISABLED: {
118+
auto reason = Common_ServiceStatusUpdateReason::PROTECTION_DISABLED;
119+
return reason;
120+
}
111121
default: {
112122
auto reason = Common_ServiceStatusUpdateReason::INVALID_ENUM;
113123
return reason;
@@ -170,6 +180,24 @@ INSTANTIATE_TEST_CASE_P(
170180
ServiceUpdate(ServiceType::kMobileNav, ServiceStatus::PTU_FAILED),
171181
ServiceUpdate(ServiceType::kRpc, ServiceStatus::PTU_FAILED)));
172182

183+
INSTANTIATE_TEST_CASE_P(
184+
OnServiceUpdate_PROTECTION_ENFRORCED,
185+
ServiceStatusUpdateHandlerTest,
186+
::testing::Values(
187+
ServiceUpdate(ServiceType::kAudio, ServiceStatus::PROTECTION_ENFORCED),
188+
ServiceUpdate(ServiceType::kMobileNav,
189+
ServiceStatus::PROTECTION_ENFORCED),
190+
ServiceUpdate(ServiceType::kRpc, ServiceStatus::PROTECTION_ENFORCED)));
191+
192+
INSTANTIATE_TEST_CASE_P(
193+
OnServiceUpdate_PROTECTION_DISABLED,
194+
ServiceStatusUpdateHandlerTest,
195+
::testing::Values(
196+
ServiceUpdate(ServiceType::kAudio, ServiceStatus::PROTECTION_DISABLED),
197+
ServiceUpdate(ServiceType::kMobileNav,
198+
ServiceStatus::PROTECTION_DISABLED),
199+
ServiceUpdate(ServiceType::kRpc, ServiceStatus::PROTECTION_DISABLED)));
200+
173201
TEST_P(ServiceStatusUpdateHandlerTest, OnServiceUpdate) {
174202
auto service_event_ = GetServiceEvent(GetParam().service_status_);
175203
auto reason_ = GetUpdateReason(GetParam().service_status_);

0 commit comments

Comments
 (0)